Last updated: August 26, 2026.
A column’s data type defines the values it can store and the operations a database can perform efficiently. Exact names and limits vary by database engine.
| Category | Common SQL types | Use |
|---|---|---|
| Exact numbers | SMALLINT, INTEGER, BIGINT, DECIMAL(p,s) | Counts, identifiers, and exact monetary values |
| Approximate numbers | REAL, DOUBLE PRECISION | Scientific measurements where approximation is acceptable |
| Text | CHAR(n), VARCHAR(n), TEXT | Names, codes, and free-form text |
| Date and time | DATE, TIME, TIMESTAMP | Calendar and event values |
| Logical | BOOLEAN or engine-specific equivalent | True/false state |
| Binary and structured | BINARY, BLOB, JSON, XML | Files or structured documents |
Example table
CREATE TABLE orders (
order_id BIGINT PRIMARY KEY,
customer_name VARCHAR(200) NOT NULL,
order_total DECIMAL(12, 2) NOT NULL,
placed_at TIMESTAMP NOT NULL,
is_paid BOOLEAN NOT NULL
);Choose the narrowest type that represents the domain without losing valid values. Use exact decimal types for money and check your database’s documentation for ranges, time-zone behavior, and engine-specific types.