
- 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 MySQL NULL-safe equal operator and how it is different from comparison operator?
MySQL NULL-safe equal operator, equivalent to standard SQL IS NOT DISTINCT FROM operator, performs an equality comparison like = operator. Its symbol is <=>. It performs differently from the comparison operators in the case when we have NULL as both the operands. Consider the following examples to understand NULL-safe operator along with its difference with comparison operator −
mysql> Select 50 <=> 50, NULL <=> NULL, 100 <=> NULL; +-----------+---------------+--------------+ | 50 <=> 50 | NULL <=> NULL | 100 <=> NULL | +-----------+---------------+--------------+ | 1 | 1 | 0 | +-----------+---------------+--------------+ 1 row in set (0.00 sec) mysql> Select 50 = 50, NULL = NULL, 100 = NULL; +---------+-------------+------------+ | 50 = 50 | NULL = NULL | 100 = NULL | +---------+-------------+------------+ | 1 | NULL | NULL | +---------+-------------+------------+ 1 row in set (0.00 sec)
- Related Articles
- How MySQL NULL-safe equal operator performs when used with row comparisons?
- What is the difference between MySQL ISNULL() function and IS NULL operator?
- What is MySQL REGEXP operator and how it handles pattern matching?
- What is the significant difference between MySQL LIKE and equal to (=) operator?
- What is a "null coalescing" operator in JavaScript?
- MySQL syntax not evaluating with not equal operator in presence of null?
- How does comparison operator work with date values in MySQL?
- How to use comparison operator for numeric string in MySQL?
- What is the operator in MySQL?
- Why we cannot use comparison operator(=) for getting the rows with NULL from a table?
- Comparison between "&&" and "AND" operator in PHP.
- What is the use of MySQL IS and IS NOT operator?
- Is there a “null coalescing” operator in JavaScript?
- In MySQL, how does the precedence of ! operator in comparison with NOT operator depends upon HIGH_NOT_PRECEDENCE SQL mode?
- Difference between the Ternary operator and Null coalescing operator in php

Advertisements