Learn DBMS and MySQL

Our tutorial provides basic and advance concepts of database management and MySQL commands with detailed examples

DBMS Introduction
MySQL Database
MySQL Tables
MySQL Queries
MySQL Clauses
MySQL Conditions
MySQL Keys

MySQL EXISTS Operator

The EXISTS operator in MySQL is a type of Boolean operator which returns the true or false result. It is used in combination with a subquery and checks the existence of data in a subquery.

It means if a subquery returns any record, this operator returns true. Otherwise, it will return false. The true value is always represented numeric value 1, and the false value represents 0. We can use it with SELECT, UPDATE, DELETE, INSERT statement.

The following are the syntax to use the EXISTS operator in MySQL:

SELECT col_names  
FROM tab_name  
WHERE [NOT] EXISTS (  
    SELECT col_names   
    FROM tab_name   
    WHERE condition  
);  

Let's move on to use of NOT in MySQL


Share this page on :