Understand how SQLite types your columns
Unlike most databases, SQLite does not strictly type columns. Instead each column has a type affinity derived from its declared type name, and each value is stored in one of five storage classes. This tool resolves any declared type name to its affinity, shows which of the five rules matched, and lists the storage classes — so you can predict how SQLite will store and convert your data. It runs entirely in your browser.
How it works
SQLite applies five rules to the declared type name, in order, stopping at the first match. The rules are case-insensitive substring tests:
1. type name contains "INT" -> INTEGER
2. contains "CHAR" or "CLOB" or "TEXT" -> TEXT
3. contains "BLOB", or no type was declared -> BLOB
4. contains "REAL" or "FLOA" or "DOUB" -> REAL
5. otherwise -> NUMERIC
So VARCHAR(255) matches rule 2 (it contains CHAR) and gets TEXT affinity,
while BIGINT matches rule 1 and gets INTEGER affinity. The affinity then
guides conversion: an INTEGER column stores a value with no fractional part as
an integer, a TEXT column converts numbers to their text form, and a BLOB
column stores data with no coercion at all.
Tips and notes
- The storage class is per value, so the same column can legitimately hold an integer in one row and a string in another.
- A column declared with an unrecognised type name like
juliandatefalls through to rule 5 and gets NUMERIC affinity — not an error. - If you want real type enforcement, create the table with the
STRICTkeyword and use onlyINT,INTEGER,REAL,TEXT,BLOBorANY. INTEGER PRIMARY KEYis special: it becomes an alias for the internal rowid and is the most efficient primary key.