NULLIF
NULLIF is a SQL function in the SELECT Queries category. Returns NULL if two expressions are equal, otherwise returns the first expression. The syntax is NULLIF(expression1, expression2). It accepts expression1, expression2. It returns nULL or expression1. A typical example: SELECT NULLIF(column_a, column_b) FROM table; -- Returns NULL if values match, otherwise column_a A close relative is SELECT, which retrieves data from a table. The most fundamental SQL statement. A close relative is SELECT *, which selects all columns from a table. A close relative is SELECT DISTINCT, which returns only distinct (unique) values from the specified columns. More about this category: Core SELECT query clauses — SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT. Related SELECT Queries entries: SELECT, SELECT *, SELECT DISTINCT, WHERE, AND / OR / NOT, IN, BETWEEN, LIKE. This page is part of the free SQL Reference documentation covering 762+ statements, functions, and clauses, each with syntax, parameters, return values, and examples for MySQL, PostgreSQL, SQL Server, and SQLite.