Account
Categories

NOT EXISTS Operator


NOT EXISTS:
In MySQL, when you use the NOT EXISTS operator in the query, it checks the data.
If data doesn't exist in the query, the NOT EXISTS operator returns TRUE; otherwise, it returns FALSE.

Syntax:

    SELECT employee_name
    FROM employees e
    WHERE NOT EXISTS (
    SELECT 1
    FROM salaries s
    WHERE s.employee_id = e.employee_id
    AND s.salary > 50000
);