You specify the opposite of any condition by typing NOT before it.
If you specify >, <, or =, you must type NOT in front of the entire condition.
For example, type:
WHERE NOT YEARS = 10
If you specify a NULL, LIKE, IN, or BETWEEN condition, type NOT right before the condition keyword.
For example, type:
WHERE YEARS IS NOT NULL
WHERE YEARS IS NOT NULL
The following query selects employees whose salary is under $16,000.00 and over $22,000.00:
SELECT ID, NAME, SALARY FROM Q.STAFF WHERE SALARY NOT BETWEEN 16000 AND 22000
The 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