w3resource
SQL exercises

SQL Subquery Exercises: Find all those customers who hold a different grade than any customer of the city Dallas

SQL SUBQUERY : Exercise-30 with Solution

30. Write a query to find all those customers who hold a different grade than any customer of the city Dallas.

Sample table: Customer


Sample Solution:

SELECT *
FROM customer 
WHERE NOT grade = ANY
   (SELECT grade
	FROM customer
	WHERE city='Dallas');

Sample Output:

customer_id	cust_name		city		grade	salesman_id
3002		Nick Rimando		New York	100	5001
3007		Brad Davis		New York	200	5001
3005		Graham Zusi		California	200	5002
3008		Julian Green		London		300	5002
3004		Fabian Johnson		Paris		300	5006
3009		Geoff Cameron		Berlin		100	5003
3003		Jozy Altidor		Moscow		200	5007
3001		Brad Guzan		London			5005

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Find all those customers who hold a different grade than any customer of the city Dallas - Duration

Rows:

Query visualization of Find all those customers who hold a different grade than any customer of the city Dallas - Rows

Cost:

Query visualization of Find all those customers who hold a different grade than any customer of the city Dallas - Cost

Contribute your code and comments through Disqus.

Previous: Write a query to find all those customers whose grade are not as the grade, belongs to the city Paris.
Next: Write a SQL query to find the average price of each manufacturer's products along with their name.

What is the difficulty level of this exercise?



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