MySQL | NULLIF( ) Function Last Updated : 19 May, 2021 Comments Improve Suggest changes 1 Likes Like Report The MySQL NULLIF() function is used for the comparison of two expressions. The NULLIF() function returns NULL if both the expressions are equal, else it returns the first expression. The NULLIF() function accepts the expressions as parameter and returns NULL if both of them are equal. Syntax: NULLIF(expression1, expression2) Parameters Used: expression1 - It is used to specify the first expression. expression2 - It is used to specify the second expression. Return Value: The MySQL NULLIF() function returns NULL if both the expressions passed are equal or else it returns the first expression if both the expressions are not equal. Supported Versions of MySQL: MySQL 5.7MySQL 5.6MySQL 5.5MySQL 5.1MySQL 5.0MySQL 4.1MySQL 4.0MySQL 3.23 Example-1: Implementing NULLIF() function by comparing two same strings. SELECT NULLIF("Geeksforgeeks", "Geeksforgeeks"); Output: NULL Example-2: Implementing NULLIF() function by comparing two unequal strings. SELECT NULLIF("123", "Geeksforgeeks"); Output: 123 Example-3: Implementing NULLIF() function by comparing two integer values. SELECT NULLIF(2, 4); Output: 2 Create Quiz Comment S Shubrodeep Banerjee Follow 1 Improve S Shubrodeep Banerjee Follow 1 Improve Article Tags : SQL mysql SQLmysql Explore BasicsWhat is SQL?6 min readSQL Data Types3 min readSQL Operators4 min readSQL Commands | DDL, DQL, DML, DCL and TCL Commands4 min readSQL Database Operations3 min readSQL CREATE TABLE3 min readQueries & OperationsSQL SELECT Query3 min readSQL INSERT INTO Statement4 min readSQL UPDATE Statement3 min readSQL DELETE Statement3 min readSQL - WHERE Clause2 min readAliases in SQL2 min readSQL Joins & FunctionsSQL Joins (Inner, Left, Right and Full Join)4 min readSQL CROSS JOIN1 min readSQL | Date Functions3 min readSQL | String functions6 min readData Constraints & Aggregate FunctionsSQL NOT NULL Constraint2 min readSQL PRIMARY KEY Constraint5 min readSQL Count() Function4 min readSQL SUM() Function2 min readSQL MAX() Function3 min readAVG() Function in SQL2 min readAdvanced SQL TopicsSQL Subquery5 min readWindow Functions in SQL6 min readSQL Stored Procedures7 min readSQL Triggers5 min readSQL Performance Tuning6 min readSQL TRANSACTIONS6 min readDatabase Design & SecurityIntroduction of ER Model9 min readIntroduction to Database Normalization6 min readSQL Injection11 min readSQL Data Encryption5 min readSQL Backup4 min readWhat is Object-Relational Mapping (ORM) in DBMS?7 min read Like