Minus in DBMS

This operator is used to display the records that are present only in the first table or query, and doesn’t present in second table / query. It basically subtracts the first query results from the second.

Let us see the same example with MINUS operator.

SELECT EMP_ID, EMP_NAME, EMP_ADDRESS, EMP_SSN 
FROM EMP_TEST
MINUS
SELECT EMP_ID, EMP_NAME, EMP_ADDRESS, EMP_SSN 
FROM EMP_DESIGN;

We can notice in the above result that only the records that do not exists in EMP_DESIGN are displayed in the result. The record which appears in both the tables is eliminated. Similarly, the records that appear in second query but not in the first query are also eliminated.

Translate »