Scalar Functions — Math
Math functions cover standard arithmetic, trigonometry, logarithms, rounding, and numeric utility functions. Most are universally supported. The main gaps are statistical functions like gamma() and loggamma(), and float inspection functions like isnan() and isfinite(), which are unavailable in SQLite.
Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten
| Function | SQLite | MySQL | ClickHouse | PostgreSQL | DuckDB | Notes |
|---|---|---|---|---|---|---|
abs() | ✅ | ✅ | ✅ | ✅ | ✅ | |
ceiling() | ✅ | ✅ | ✅ | ✅ | ✅ | ceil() |
floor() | ✅ | ✅ | ✅ | ✅ | ✅ | |
round() | ✅ | ✅ | ✅ | ✅ | ✅ | |
sqrt() | ✅ | ✅ | ✅ | ✅ | ✅ | |
pow() | ✅ | ✅ | ✅ | ✅ | ✅ | |
exp() | ✅ | ✅ | ✅ | ✅ | ✅ | SQLite also takes exp2() and exp10(), as pow(2.0, x) and pow(10.0, x) |
log() | ✅ | ✅ | ✅ | ✅ | ✅ | Two-arg form: ln(x)/ln(base) |
log10() | ✅ | ✅ | ✅ | ✅ | ✅ | |
log2() | ✅ | ✅ | ✅ | ✅ | ✅ | |
pi() | ✅ | ✅ | ✅ | ✅ | ✅ | |
rand() | ✅ | ✅ | ✅ | ✅ | ✅ | random() in SQLite/Postgres/DuckDB |
cos(), sin(), tan() | ✅ | ✅ | ✅ | ✅ | ✅ | |
acos(), asin(), atan(), atan2() | ✅ | ✅ | ✅ | ✅ | ✅ | |
sign() | ✅ | ✅ | ✅ | ✅ | ✅ | |
max_of() | ✅ | ✅ | ✅ | ✅ | ✅ | greatest() |
min_of() | ✅ | ✅ | ✅ | ✅ | ✅ | least() |
gamma() | ❌ | ❌ | ✅ | ✅ | ✅ | |
loggamma() | ❌ | ❌ | ✅ | ❌ | ✅ | ClickHouse & DuckDB: lgamma() |
beta_cdf(), gamma_cdf() | ❌ | ❌ | ❌ | ❌ | ❌ | Not implemented |
isfinite() | ❌ | ❌ | ✅ | ✅ | ✅ | |
isinf() | ✅ | ⚠️ | ✅ | ✅ | ✅ | SQLite: exact ABS(val) > DBL_MAX; MySQL: ABS(val) > 1e308 (approximated, warns); Postgres: val = 'infinity' OR val = '-infinity'; DuckDB: isinf() |
isnan() | ❌ | ❌ | ✅ | ✅ | ✅ |