This tutorial explains how to use the MySQL EXISTS condition with syntax and examples.
The MySQL EXISTS condition is used in combination with a subquery and is considered "to be met" if the subquery returns at least one row. It can be used in a SELECT, INSERT, UPDATE, or DELETE statement.
The syntax for the EXISTS condition in MySQL is:
Parameters or Arguments
A SELECT statement that usually starts with SELECT * rather than a list of expressions or column names. MySQL ignores the list of expressions in the subquery anyways.
SQL statements that use the EXISTS Condition in MySQL are very inefficient since the sub-query is RE-RUN for EVERY row in the outer query's table. There are more efficient ways to write most queries, that do not use the EXISTS Condition.