SQL NULL-Handling Functions Across Dialects: COALESCE, ISNULL, and IFNULL
By Sharon Ben-Moshe · August 2, 2026 · 3 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
COALESCE, ISNULL, and IFNULL all claim to "handle NULLs" — but they aren't portable, and one of them means something completely different in MySQL than it does in SQL Server. Here's the dialect-by-dialect breakdown.
Quick answer
COALESCE is the only NULL-replacement function that works identically across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery. ISNULL(expr, value) is SQL Server-only, IFNULL(expr, value) works in MySQL, SQLite, and BigQuery — and MySQL's ISNULL(expr) is a completely different, boolean-returning function with the same name.