MINUS returns all rows from the first SELECT that are not also returned by the second SELECT.
The Syntax of MINUS
<Component Query>
MINUS
<Component Query>
For example:
SELECT CUST_NBR, NAME FROM CUSTOMER WHERE REGION_ID = 5
MINUS
SELECT C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE C.CUST_NBR IN (SELECT O.CUST_NBR FROM CUST_ORDER O, EMPLOYEE E WHERE O.SALES_EMP_ID = E.EMP_ID AND E.LNAME = 'MARTIN');
No comments:
Post a Comment