Monday, 29 August 2016

Logical Operator - NOT

Keep up the good work! There is one more logical operator worth mentioning: NOT. Basically speaking, whatever is stated after NOT will be negated:

SELECT *
FROM user
WHERE age NOT BETWEEN 20 AND 30;

In the above example we placed NOT in front of a BETWEEN clause. As a result, we'll get all users except for those aged 20 to 30.

Syntax
SELECT 8 FROM table_name WHERE column_name NOT BETWEEN value1 AND value2;

Execute below code
SELECT vin, brand, model FROM car WHERE production_year NOT BETWEEN 1995 AND 2005;


VIN
BRAND
MODEL
WPOZZZ79ZTS372128
Ford
Fusion
KLATF08Y1VB363636
Volkswagen
Golf
1M8GDM9AXKP042788
Volkswagen
Golf
GS723HDSAK2399002
Opel
Corsa

No comments:

Post a Comment