SQLite Tutorial SQLite Advanced SQLite Database SQLite References

SQLite TYPEOF() Function



The SQLite TYPEOF() function returns a string that indicates the datatype of the specified expression. It can return the following:

  • "null"
  • "integer"
  • "real"
  • "text"
  • "blob"

Syntax

TYPEOF(X)

Parameters

X Required. Specify the expression to find out it's datatype.

Return Value

Returns a string indicating the datatype of the specified expression.

Example: typeof() example

The example below shows the usage of TYPEOF() function.

SELECT TYPEOF(10);
Result: "integer"

SELECT TYPEOF(10.5);
Result: "real"

SELECT TYPEOF("Hello World");
Result: "text"

SELECT TYPEOF(10/20);
Result: "integer"

SELECT TYPEOF(DATE('2018-08-18'));
Result: "text"

SELECT TYPEOF(null);
Result: "null"

❮ SQLite Functions