Tutorial by Examples

sqlite> SELECT TYPEOF(NULL); null sqlite> SELECT TYPEOF(42); integer sqlite> SELECT TYPEOF(3.141592653589793); real sqlite> SELECT TYPEOF('Hello, world!'); text sqlite> SELECT TYPEOF(X'0123456789ABCDEF'); blob
For booleans, SQLite uses integers 0 and 1: sqlite> SELECT 2 + 2 = 4; 1 sqlite> SELECT 'a' = 'b'; 0 sqlite> SELECT typeof('a' = 'b'); integer > CREATE TABLE Users ( Name, IsAdmin ); > INSERT INTO Users VALUES ('root', 1); > INSERT INTO Users VALUES ('john', 0); > S...
SQLite uses dynamic typing and ignores declared column types: > CREATE TABLE Test ( Col1 INTEGER, Col2 VARCHAR(2), -- length is ignored, too Col3 BLOB, Col4, -- no type required Col5 FLUFFY BUNNIES -- use whatever you want ); > ...
SQLite has no separate data type for date or time values. ISO8601 strings The built-in keywords CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP return strings in ISO8601 format: > SELECT CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP; CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP --------...

Page 1 of 1