SQLite Tutorial SQLite Advanced SQLite Database SQLite References

SQLite - Data Types



SQLite Data Type is an attribute which specifies the type of data that will be stored inside each column when creating a table. The data type is a guideline for SQLite to understand what type of data is expected inside of each column, and it also identifies how SQLite will interact with the stored data.

Each value stored in an SQLite database (or manipulated by the database engine) has one of the following data types:

  • NUMERIC
  • INTEGER
  • REAL
  • TEXT
  • BLOB

To be compatible with other SQL databases, SQLite allows to use the common datatype names which is used in other databases and maps them to their basic SQLite datatypes (listed above).

Note: The "BLOB" data type used to be called "NONE".

SQLite Numeric Data Types

All numeric datatypes in SQLite are converted to INTEGER, NUMERIC, or REAL datatypes.

The following are the Numeric Datatypes in SQLite:

Data Type SyntaxDescription
TINYINTEquivalent to INTEGER
SMALLINTEquivalent to INTEGER
MEDIUMINTEquivalent to INTEGER
INTEquivalent to INTEGER
INTEGEREquivalent to INTEGER
BIGINTEquivalent to INTEGER
INT2Equivalent to INTEGER
INT4Equivalent to INTEGER
INT8Equivalent to INTEGER
UNSIGNED BIG INTEquivalent to INTEGER
NUMERICEquivalent to NUMERIC
DECIMALEquivalent to NUMERIC
REALEquivalent to REAL
DOUBLEEquivalent to REAL
DOUBLE PRECISIONEquivalent to REAL
FLOATEquivalent to REAL
BOOLEANEquivalent to NUMERIC

SQLite String Data Types

All string datatypes in SQLite are converted to a TEXT datatype. If a size is specified for a string datatype, SQLite will ignore it, as it does not allow size restrictions on string datatypes.

The following are the String Datatypes in SQLite:

Data Type SyntaxDescription
CHAR(size)Equivalent to TEXT
CHARACTER(size)Equivalent to TEXT
VARYING CHARACTER(size)Equivalent to TEXT
VARCHAR(size)Equivalent to TEXT
TINYTEXT(size)Equivalent to TEXT
TEXT(size)Equivalent to TEXT
MEDIUMTEXT(size)Equivalent to TEXT
LONGTEXT(size)Equivalent to TEXT
NCHAR(size)Equivalent to TEXT
NVARCHAR(size)Equivalent to TEXT
NATIVE CHARACTER(size)Equivalent to TEXT
CLOB(size)Equivalent to TEXT

SQLite Date and Time Data Types

All date or time datatypes in SQLite are converted to NUMERIC datatypes.

The following are the Date and Time Datatypes in SQLite:

Data Type SyntaxDescription
DATEEquivalent to NUMERIC
DATETIMEEquivalent to NUMERIC
TIMESTAMPEquivalent to NUMERIC
TIMEEquivalent to NUMERIC

SQLite Large Object (LOB) Data Types

The following are the LOB Datatypes in SQLite:

Data Type SyntaxDescription
BLOBEquivalent to BLOB
no datatype specifiedEquivalent to BLOB