Category: SQL Queries

The MINUS query will compare each record in statementl to a record in statement2. The result returned will be records in Select Statement I that are not in Select statement2.

 

Syntax: SQL Statement 1]

MINUS

[SQL Statement 2]

SELECT ENAME, EMPNO FROM EMP WHERE

ENAME LIKE 'M%,' OR ENAME LIKE 'J%,'

MINUS

SELECT ENAME, EMPNO FROM EMP WHERE

ENAME LIKE 'J%' OR ENAME LIKE 'A%';

 

On execution it will return those rows which exist in first statement only. It will not display common rows at all.



Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request please get @me on
linkedin FaceBook Twitter Google Plus