The MySQL does not support MINUS operator. However you can still achive MINUS with MySQL join. Basically, MINUS operator compares results of two SELECT statement and returns distinct rows from the first SELECT statement that aren't present in the second SELECT statement.
To compares results of two SELECT statement and returns distinct rows from the first SELECT statement that aren't present in the second SELECT statement, use the following syntax:
Parameters:
tablename1 & 2: The table name from which you want to achive MINUS
operator.
LEFT JOIN
to perform MINUS operator in MySQL:
Note:
In the above example, the LEFT JOIN
is uses to achive MINUS with MySQL join.
You can use MySQL Command Line Client to use MINUS
in MySQL use join to achive MINUS operator. It will look like this: