MINUS Operator
The MINUS
operator returns the rows from the first SELECT query that are not present in the second SELECT query. (Note: The MINUS
operator is specific to certain SQL dialects, such as Oracle.)
Example: Using MINUS
SELECT Name FROM FreedomFighters WHERE City = 'Chennai'
MINUS
SELECT Name FROM FreedomFighters WHERE Contribution = 'Healthcare';
Output:
Returns names of freedom fighters from Chennai who have not contributed to healthcare.
Notes
- Both queries must return the same number of columns.
- Data types of corresponding columns must be compatible.