MySQL | NULLIF( ) Function Last Updated : 19 May, 2021 Comments Improve Suggest changes Like Article 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 Comment More infoAdvertise with us Next Article MySQL | NULLIF( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : SQL mysql SQLmysql Similar Reads TAN() Function in MySQL TAN() function : This function in MySQL is used to return the tangent of a specified number. In any right triangle, the tangent of an angle is the length of the opposite side divided by the length of the adjacent side. Similarly, this can also be defined as tangent of x is the sine of x divided by t 1 min read MySQL IF( ) Function The MySQL IF() function is a control flow function that returns different values based on the result of a condition. IF() Function in MySQLThe IF() function in MySQL returns a value if the condition is TRUE and another value if the condition is FALSE. The MySQL IF() function can return values that c 2 min read MySQL CASE() Function MySQL CASE function is a conditional statement that returns a value when the first condition is met. Once a condition is met, the CASE function does not check for other conditions. If no condition is met it returns the output in ELSE part. CASE Function in MySQLThe CASE Function in MySQL allows usin 4 min read SQL MIN() Function The MIN() function in SQL is a powerful tool that allows us to determine the smallest or lowest value from a specified column or expression. It is widely used in data analysis to extract minimum values for decision-making, reporting, and business insights. This function automatically excludes NULL v 8 min read YEAR() Function in MySQL YEAR() function in MySQL is used to find year from the given date. If the date is NULL, the YEAR() function will return NULL. Otherwise, it returns value range from 1000 to 9999. Syntax : YEAR(date) Parameter : This method accepts one parameter as mentioned above and described below : date : The dat 3 min read Like