w3resource
SQL exercises

SQL: Display all customers, who are neither belongs to the city New York nor with a grade above 100

SQL Boolean Operator Statement: Exercise-5 with Solution.

Write a SQL query to display those customers who are neither belongs to the city New York nor grade value is more than 100. 

Sample table: customer


Sample Solution :

SELECT * 
FROM customer 
WHERE NOT (city = 'New York' OR grade>100);

Output of the Query:

customer_id	cust_name	city	grade	salesman_id
3009		Geoff Cameron	Berlin	100	5003

Explanation :

Syntax of display those customers who are neither belongs to the city New York nor grade value is more than 100

Pictorial presentation :

Result of display those customers who are neither belongs to the city New York nor grade value is more than 100

Query Visualization:

Duration:

Query visualization of Display all customers, who are neither belongs to the city New York nor with a grade above 100 - Duration

Rows:

Query visualization of Display all customers, who are neither belongs to the city New York nor with a grade above 100 - Rows

Cost:

Query visualization of Display all customers, who are neither belongs to the city New York nor with a grade above 100 - Cost

 

Practice Online


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a SQL statement to display all the customers, who are either belongs to the city New York or not had a grade above 100.
Next: Write a SQL statement to display either those orders which are not issued on date 2012-09-10 and issued by the salesman whose ID is 505 and below or those orders which purchase amount is 1000.00 and below.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming