Every column has a data type, which says what kind of value it holds: text, a whole number, a decimal, a date. The type decides what can be stored, how much space it takes, and how values compare and sort. Choosing well up front saves awkward ALTER TABLE changes later.
The names vary between databases, but the families are the same everywhere. This page covers the types you will use most, rather than every type each database offers.
| Holds | Standard | MySQL | SQL Server | PostgreSQL | Oracle |
|---|---|---|---|---|---|
| text up to a set length | varchar(n) |
VARCHAR(n) |
varchar(n), or nvarchar(n) for any language |
varchar(n) |
VARCHAR2(n) |
| text padded to an exact length | char(n) |
CHAR(n) |
char(n) |
char(n) |
CHAR(n) |
| long text | TEXT |
varchar(max) |
text |
CLOB |
Use varchar for nearly everything. char pads short values with spaces, which suits only values that always have the same length, such as a two-letter country code.
Numbers
Section titled “Numbers”| Holds | Standard | MySQL | SQL Server | PostgreSQL | Oracle |
|---|---|---|---|---|---|
| whole numbers | int |
INT |
int |
integer |
NUMBER(10) |
| larger whole numbers | bigint |
BIGINT |
bigint |
bigint |
NUMBER(19) |
| exact decimals | decimal(p, s) |
DECIMAL(p, s) |
decimal(p, s) |
numeric(p, s) |
NUMBER(p, s) |
| approximate decimals | float |
DOUBLE |
float |
double precision |
BINARY_DOUBLE |
In decimal(10, 2), the 10 is the total number of digits and the 2 is how many come after the decimal point, so it holds values up to 99,999,999.99.
Dates and times
Section titled “Dates and times”| Holds | MySQL | SQL Server | PostgreSQL | Oracle |
|---|---|---|---|---|
| a date | DATE |
date |
date |
DATE, which also holds a time |
| a date and time | DATETIME |
datetime2 |
timestamp |
TIMESTAMP |
| a time of day | TIME |
time |
time |
SQL Dates covers writing and comparing them.
Other types
Section titled “Other types”| Holds | MySQL | SQL Server | PostgreSQL | Oracle |
|---|---|---|---|---|
| true or false | BOOLEAN, stored as 0 or 1 |
bit |
boolean |
BOOLEAN from version 23ai; NUMBER(1) before |
| raw bytes, such as a file | BLOB |
varbinary(max) |
bytea |
BLOB |
| a unique identifier | BINARY(16) or CHAR(36) |
uniqueidentifier |
uuid |
RAW(16) |
| JSON documents | JSON |
json from SQL Server 2025; nvarchar(max) before |
jsonb |
JSON |
SQLite and Access
Section titled “SQLite and Access”SQLite is flexible about types. It accepts any of the names above, but stores each value as one of a few kinds: integer, real, text or binary. A column declared decimal(10, 2) is held as a number, not an exact decimal, so keep money in whole pence in an integer column if exact sums matter.
Microsoft Access uses its own names in its table designer: Short Text and Long Text for text, Number and Currency for numbers, Date/Time, Yes/No for true or false, and AutoNumber for a column that numbers itself.