SQL - Data Type
Table of Contents
1 - About
The Data Type of a column in SQL.
They are defined in the ANSI standard but may vary from sql engine (database) to another.
2 - Articles Related
3 - List
Sql Type | Description (Range) | Precision | Jdbc Sql Type Constant |
---|---|---|---|
Fixed point Number (exact numeric) | |||
NUMERIC | fixed-point with precision and scale | (up to 131072) and scale (up to 16383) | NUMERIC |
DECIMAL | alias for numeric | DECIMAL | |
Integer (exact numeric, with binary or decimal precision and scale of 0) | |||
TINYINT | Tiny Integer | 0 to 255 (1 Bytes) | TINYINT |
SMALLINT | Small Integer | ±32768 (2 Bytes) | SMALLINT |
INTEGER | Integer | ±2147483648 (4 Bytes) | INTEGER |
BIGINT | Big Integer | ±9223372036854775808 (8 Bytes) | BIGINT |
Floating point Number (approximate numeric) | |||
FLOAT | precision may defined | Single precision | FLOAT |
REAL | precision is fixed | Single precision (4 Bytes) | REAL |
DOUBLE PRECISION | precision greater than REAL | Double Precision | DOUBLE |
Text | |||
SQL - Char(N) datatype | text padded with space | CHAR | |
SQL - VARCHAR(N) datatype | variable text | VARCHAR | |
Time | |||
SQL - Date datatype | Time at the day level | DATE | |
SQL - Timestamp Data Type | Time at the ms level | TIMESTAMP | |
SQL - TIME data type | time part (hh:mm:ss) | TIME | |
interval | INTERVAL | ||
Others | |||
BLOB | binary large object (binary data) | ||
SQL - Identifier | |||
SQL - Struct Data Type (Record) |
4 - Documentation / Reference
- See the section 6.1 page 107 of SQL92