I rather think that

NULLIF(A, B)

is syntactic sugar for

CASE WHEN A = B THEN NULL ELSE A END

But you are correct: it is mere syntactic sugar to aid the human reader.

🌐
W3Schools
w3schools.com › sql › func_sqlserver_nullif.asp
SQL Server NULLIF() Function
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... The NULLIF() function returns NULL if two expressions are equal, otherwise it returns the first expression.
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › language-elements › nullif-transact-sql
NULLIF (Transact-SQL) - SQL Server | Microsoft Learn
Copy CREATE TABLE budgets ( dept TINYINT, current_year DECIMAL(10,2), previous_year DECIMAL(10,2) ); INSERT INTO budgets VALUES(1, 100000, 150000); INSERT INTO budgets VALUES(2, NULL, 300000); INSERT INTO budgets VALUES(3, 0, 100000); INSERT INTO budgets VALUES(4, NULL, 150000); INSERT INTO budgets VALUES(5, 300000, 300000); SELECT dept, NULLIF(current_year, previous_year) AS LastBudget FROM budgets; Here's the result set. dept LastBudget ---- ----------- 1 100000.00 2 null 3 0.00 4 null 5 null · CASE (Transact-SQL) decimal and numeric (Transact-SQL) System Functions (Transact-SQL)
🌐
SQL Server Tutorial
sqlservertutorial.net › home › sql server basics › sql server nullif
SQL Server NULLIF
July 10, 2020 - The following example uses the NULLIF expression. It returns NULL because the first character string is equal to the second one: SELECT NULLIF('Hello', 'Hello') result; Code language: SQL (Structured Query Language) (sql)
🌐
W3Schools
w3schools.com › sql › func_mysql_nullif.asp
MySQL NULLIF() Function
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... The NULLIF() function compares two expressions and returns NULL if they are equal.
🌐
TechOnTheNet
techonthenet.com › sql_server › functions › nullif.php
SQL Server: NULLIF Function
In SQL Server (Transact-SQL), the NULLIF function compares expression1 and expression2. If expression1 and expression2 are equal, the NULLIF function returns NULL.
🌐
Oracle
docs.oracle.com › en › database › oracle › › › › › › oracle-database › 19 › sqlrf › NULLIF.html
SQL Language Reference
July 15, 2025 - Appendix C in Oracle Database Globalization Support Guide for the collation determination rules, which define the collation NULLIF uses to compare characters from expr1 with characters from expr2, and for the collation derivation rules, which define the collation assigned to the return value of this function when it is a character value ... The following example selects those employees from the sample schema hr who have changed jobs since they were hired, as indicated by a job_id in the job_history table different from the current job_id in the employees table:
🌐
GeeksforGeeks
geeksforgeeks.org › sql › nullif-function-in-sql-server
NULLIF() Function in SQL Server - GeeksforGeeks
July 23, 2025 - NULLIF() function in SQL Server is used to check if the two specified expressions are equal or not. If two arguments passed to a function are equal, the NULLIF() function returns Null to us. NULLIF() function operates like a Like a CASE Statement.
🌐
DotFactory
dofactory.com › sql › nullif
SQL NULLIF Function
SELECT NULLIF('SQL', 'NoSQL') AS NotEqual, NULLIF('SQL', 'SQL') AS Equal Try it live
Find elsewhere
🌐
Hightouch
hightouch.com › sql-dictionary › sql-nullif
SQL NULLIF - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - This result includes product names, but it replaces 'Discontinued' with NULL using the NULLIF function. Replacing specific values with NULL in query results. Suppressing or hiding data based on specific conditions. Handling equality as a distinct case. The SQL NULLIF function is a standard SQL feature and is available in most relational database management systems (RDBMS) that support SQL.
🌐
Database Star
databasestar.com › sql-nullif
SQL NULLIF Function Explained with Examples | Database Star: Home
June 18, 2015 - This function can also be expressed as an IF statement (using general syntax, not SQL). 1if (expr1 = expr2) then 2 return null; 3else 4 return expr1; 5end if; The NULLIF function checks two values and returns either the first value or NULL.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › sql tutorial › sql nullif()
SQL NULLIF() | A Quick Glance to SQL NULLIF() with Examples
March 10, 2023 - SELECT AVG(COALESCE(NULLIF(sales_target,sales_current),0.00)) AS 'Avg target to be achieved' FROM sales; In the above example, we have first used NULLIF to return a null value if the salesperson has completed his or her targets and return ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
SQL Tutorial
sqltutorial.org › home › sql nullif function
SQL NULLIF Function
February 8, 2025 - The NULLIF function is equivalent to the following searched CASE expression: CASE WHEN value1 = value1 THEN NULL ELSE value1 ENDCode language: SQL (Structured Query Language) (sql) The following example uses the NULLIF function with two arguments are 100:
🌐
Snowflake Documentation
docs.snowflake.com › en › sql-reference › functions › nullif
NULLIF | Snowflake Documentation
SELECT a, b, NULLIF(a,b) FROM i; --------+--------+-------------+ a | b | nullif(a,b) | --------+--------+-------------+ 0 | 0 | [NULL] | 0 | 1 | 0 | 0 | [NULL] | 0 | 1 | 0 | 1 | 1 | 1 | [NULL] | 1 | [NULL] | 1 | [NULL] | 0 | [NULL] | [NULL] | 1 | [NULL] | [NULL] | [NULL] | [NULL] | --------+--------+-------------+ Copy · Snowflake Python APIs · Snowflake REST APIs · Snowflake CLI · See all interfaces · On this page · Syntax · Arguments · Returns · Collation details · Examples ·
🌐
Javatpoint
javatpoint.com › sql-server-nullif
SQL Server NULLIF - javatpoint
SQL Server NULLIF with sql server, install visual studio, install sql server, architecture, management studio, data types, db operations, login database, create database, select database, drop database, create table, delete tabel, update table, min function, max function, sum function, sql ...
🌐
Oracle Tutorial
oracletutorial.com › home › oracle comparison functions › oracle nullif function
Oracle NULLIF Function
April 25, 2025 - For example, the following statement returns a null value because the first argument equals the second one. SELECT NULLIF(100,100) -- null FROM dual;Code language: SQL (Structured Query Language) (sql)
🌐
DB Vis
dbvis.com › thetable › postgresql-nullif-conditional-logic-made-easier
PostgreSQL NULLIF: Conditional Logic Made Easier
September 11, 2024 - Yes, the NULLIF function can be used in conjunction with any other conditional operator or function. For example, it is often used within CASE expressions to handle specific conditions and return appropriate results. PostgreSQL NULLIF is a standard SQL function that returns NULL if two arguments ...
🌐
Database Guide
database.guide › how-nullif-works-in-sql-server
How NULLIF() Works in SQL Server
In SQL Server, the NULLIF() expression checks the value of two specified expressions. It returns a null value if they’re equal, otherwise it returns the first expression. ... Here, both expressions are equal, and so the result is a null value. Here’s what happens when the expressions are not equal: ... This time the first value is returned. Here’s an example ...
🌐
W3Schools
w3schools.com › sql › sql_isnull.asp
SQL IFNULL(), ISNULL(), COALESCE(), and NVL() Functions
String Functions: ASCII CHAR_LENGTH ... CAST COALESCE CONNECTION_ID CONV CONVERT CURRENT_USER DATABASE IF IFNULL ISNULL LAST_INSERT_ID NULLIF SESSION_USER SYSTEM_USER USER VERSION SQL Server Functions...