App Built-in SQL Functions

SQLite database engine provides a number of built-in functions (documentation is provided by official website sqlite.org)

DBCompass for SQLite provides additional sets of functions.

Information

Conversion

String

Other (contrib) String functions are described in the section below.

Date

Pattern Description Example
yy 2-digit year 25
yyyy 4-digit year 2025
M 1 or 2 digit month 1
MM 2-digit month 01
d 1 or 2 digit day of the month 2
dd 2-digit day of the month 02
h 1 or 2 digit hour (12-hour format) 1
hh 2-digit hour (12-hour format) 01
H 1 or 2 digit hour (24-hour format) 15
HH 2-digit hour (24-hour format) 15
m 1 or 2 digit minute 2
mm 2-digit minute 02
s 1 or 2 digit second 2
ss 2-digit second 02
SSS The milliseconds 123
a AM/PM for 12-hour format PM
Z RFC 822 GMT format -0600
ZZZZZ ISO 8601 time zone format -06:00

Pattern string is case-sensitive.

Encoding

Hashing

Encryption

Generator

Regex

Image

Geohash

XML

Web

Contrib Functions

Math

Compatibility note

SQLite works like PostgreSQL in that the log() function computes a base-10 logarithm. Most other SQL database engines compute a natural logarithm for log(). In the two-argument version of log(B,X), the first argument is the base and the second argument is the operand. This is the same as in PostgreSQL and MySQL, but is reversed from SQL Server which uses the second argument as the base and the first argument as the operand

Aggregate

stdev, variance, mode, median, lower_quartile, upper_quartile

String

IEEE 754 πŸ†•

The ieee754 extension converts a floating point number between its binary64 representation and the MΓ—2E format. In other words in the expression:

F = M Γ— 2E

The ieee754 extension converts between F and (M,E) and back again.

Decimal πŸ†•

The decimal extension provides arbitrary-precision decimal arithmetic on numbers stored as text strings. Because the numbers are stored to arbitrary precision and as text, no approximations are needed. Computations can be done exactly.