SQLite 3 reference · Conditional and Type Functions

SQLite TYPEOF() Function

Return the storage class of a value: 'null', 'integer', 'real', 'text' or 'blob'. Shows how SQLite stored it.

SQLite 3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

typeof(X)

Parameters

ParameterDescription
X Any value or column.

Return value

One of 'null', 'integer', 'real', 'text', 'blob'.

Examples

Storage classesTry it yourself
SELECT typeof(42) AS a, typeof(4.2) AS b, typeof('42') AS c, typeof(NULL) AS d, typeof(x'2A') AS e;

Output

a | b | c | d | e
integer | real | text | null | blob
Columns in the sample databaseTry it yourself
SELECT price, typeof(price) AS price_type, signup_date, typeof(signup_date) AS date_type
FROM products, customers
WHERE product_id = 1 AND customer_id = 1;

Output

price | price_type | signup_date | date_type
29.99 | real | 2025-01-15 | text

In other languages

Was this page helpful?