Sitemap
Elvan Tektaş

Elvan Tektaş

Full-Stack Developer - Computer Programming 👩‍💻 https://github.com/tektaselvan

SQL NOT

Jan 12, 2024

--

The NOT Operator

The NOT operator is used in combination with other operators to give the opposite result, also called the negative result.

Syntax

SELECT column1, column2, …
FROM table_name
WHERE NOT condition;

Example:

In the select statement below we want to return all customers that are NOT from Spain:

Press enter or click to view image in full size

In the example above, the NOT operator is used in combination with the = operator, but it can be used in combination with other comparison and/or logical operators. See examples below.

NOT LIKE

Example:

Select customers that does not start with the letter ‘A’

Press enter or click to view image in full size

NOT BETWEEN

Example:

Get Elvan Tektaş’s stories in your inbox

Join Medium for free to get updates from this writer.

Select products with a UnitPrice not between 20.00 and 50.00

Press enter or click to view image in full size

NOT IN

Example:

Select customers that are not from Germany or Spain

Press enter or click to view image in full size

NOT Greater Than

Example:

Select Products with a UnitPrice not greater than 50.00

Press enter or click to view image in full size

NOT Less Than

Example:

Select Products with a UnitPrice not less than 50.00

Press enter or click to view image in full size

--

--

Elvan Tektaş
Elvan Tektaş

Written by Elvan Tektaş

Full-Stack Developer - Computer Programming 👩‍💻 https://github.com/tektaselvan