
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the use of MySQL NULLIF() control flow function?
MySQL NULLIF() control flow function will return NULL if both the arguments are the same, otherwise, it returns the first argument.
Syntax
NULLIF(expression1, expression2)
Here if expression1 = expression2, NULL will be returned by NULLIF() otherwise expression1 will be returned. Following example will exhibit this −
mysql> Select NULLIF('Ram','Ram'); +---------------------+ | NULLIF('Ram','Ram') | +---------------------+ | NULL | +---------------------+ 1 row in set (0.00 sec) mysql> Select NULLIF('Ram','Shyam'); +-----------------------+ | NULLIF('Ram','Shyam') | +-----------------------+ | Ram | +-----------------------+ 1 row in set (0.00 sec)
- Related Articles
- How MySQL NULLIF() control flow function is similar to CASE statement?
- What is the use of MySQL IFNULL() control flow function?
- How does MYSQL control flow function CASE works?
- What is the difference between Flow Control and Error Control?
- What is Information Flow Control under Cybersecurity?
- What would be the default return type of MySQL IFNULL() control flow operator?
- What is the use of MySQL FROM_UNIXTIME() function?
- What is the use of MySQL GET_FORMAT() function?
- What is the use of MySQL LAST_INSERT_ID() function?
- What is the use of MySQL CONCAT_WS() function?
- What is the use of MySQL TRUNCATE() function?
- What is the use of MySQL SUBSTRING_INDEX() function?
- What is the use of MySQL UNHEX() function?
- What is the use of MySQL CHAR() function?
- What is the Flow Control in the Data Link Layer?

Advertisements