Selecting rows using opposite conditions
You specify the opposite of any condition by typing NOT before the entire condition.
For example, the following selects all rows except those rows where the employee has 10 years of service.
SELECT * FROM Q.STAFF
WHERE NOT YEARS = 10To specify the opposite of a NULL,
LIKE, IN, or BETWEEN condition, type NOT right
before the condition keyword.For example, the following selects all rows where the employee
has any number of years of service listed in the YEARS column:
SELECT * FROM Q.STAFF
WHERE YEARS IS NOT NULLThe following query selects employees
whose salary is under $16,000.00 or over $22,000.00: SELECT ID, NAME, SALARY
FROM Q.STAFF
WHERE SALARY NOT BETWEEN 16000 AND 22000The following
query selects employees whose salary is under $16,000.00 and who earn
less than $500.00 in commissions: SELECT ID, NAME, SALARY, COMM
FROM Q.STAFF
WHERE NOT SALARY > 16000 AND NOT COMM > 500