SQL Data Types

Data types in SQL defines a sort of value that a column can contain. In a database table, each column is required to have a data type with a name.

General data types in SQL

Data typeDescription
SMALLINTInteger numerical (no decimal). Precision 5
INTEGER(P) or INT(P)Integer numerical (no decimal). Precision P
INTEGERInteger numerical (no decimal). Precision 10
NUMERIC(P,S)Exact numerical (Same as DECIMAL) Precision P and scale value S.
REALapproximate numerical, mantissa precision 7
DECIMAL(P,S)Exact numerical, 'P' is precision value and 'S' is scale value.
DOUBLE PRECISIONdouble precision floating point number
FLOAT(N)Approximate numerical, floating-point with at least N digits
CHAR(N) or CHARACTER(N)character string. fixed-length N
VARCHAR(N)character string. Variable length. Maximum length N
BIT(N)'N' is the number of bits to store
BIT VARYING(N)'N' is the number of bits to store (length can vary up to N)
DATEstores year, month, and day values
TIMEstores hour, minute and second values
TIMESTAMPstores year, month, day, hour, minute and second values
TIME WITHexactly same as time but also store an offset from UTC
TIME ZONEof the time specified
TIMESTAMP WITHsame as timestamp but also stores an offset from UTC of
TIME ZONEthe time specified.

Scroll Back to Top