
- 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 IS and IS NOT operator?
In MySQL, both IS and IS NOT operators are used to test a value against a Boolean value.
The syntax of IS operator can be as follows −
Val IS Boolean_val
Here Val is the value that we want to test against Boolean value.
Boolean_val is the Boolean value against which the value would be tested and it can be TRUE, FALSE or UNKNOWN.
The syntax of IS NOT operator can be as follows −
Val IS NOT Boolean_val
Here Val is the value that we want to test against Boolean value.
Boolean_val is the Boolean value against which the val would be tested and it can be TRUE, FALSE or UNKNOWN.
Following MySQL statements will demonstrate the above −
mysql> Select 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN; +-----------+------------+-----------------+ | 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN | +-----------+------------+-----------------+ | 1 | 1 | 1 | +-----------+------------+-----------------+ 1 row in set (0.00 sec) mysql> Select 1 IS NOT TRUE, 0 IS NOT FALSE, NULL IS NOT UNKNOWN; +---------------+----------------+---------------------+ | 1 IS NOT TRUE | 0 IS NOT FALSE | NULL IS NOT UNKNOWN | +---------------+----------------+---------------------+ | 0 | 0 | 0 | +---------------+----------------+---------------------+ 1 row in set (0.00 sec) mysql> Select 0 IS NOT TRUE, 1 IS NOT FALSE, NULL IS NOT UNKNOWN; +---------------+----------------+---------------------+ | 0 IS NOT TRUE | 1 IS NOT FALSE | NULL IS NOT UNKNOWN | +---------------+----------------+---------------------+ | 1 | 1 | 0 | +---------------+----------------+---------------------+ 1 row in set (0.00 sec)
- Related Articles
- What is the use of MySQL NOT LIKE operator?
- What is the use of EXIST and EXIST NOT operator with MySQL subqueries?
- What is the use of RLIKE operator in MySQL?
- What is the use of MySQL SOUNDS LIKE operator?
- What is the use of SOUNDS LIKE operator in MySQL?
- What is the !! (not not) operator in JavaScript?
- What is "is not" operator in Python?
- What is the operator in MySQL?
- What is the benefit of MySQL ‘IS NULL’ and ‘IS NOT NULL’?
- What is the use of sizeof Operator in C#?
- What is the use of tilde operator (~) in R?
- What is JavaScript Bitwise NOT(~) Operator?
- What is the difference between MySQL ISNULL() function and IS NULL operator?
- Is the !! (not not) operator in JavaScript equivalent to reverse process of not operator?
- What is the use of scope resolution operator in C++?

Advertisements