SQL Subquery Exercises: Display the customers who have a greater gradation than any customer who belongs to the alphabetically lower than the city New York
SQL SUBQUERY: Exercise-22 with Solution
22. Write a query to display the customers who have a greater gradation than any customer who belongs to the alphabetically lower than the city New York.
Sample table: Salesman
Sample table: Customer
SELECT * FROM customer WHERE grade > ANY (SELECT grade FROM CUSTOMER WHERE city < 'New York');
customer_id cust_name city grade salesman_id 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 3003 Jozy Altidor Moscow 200 5007
Contribute your code and comments through Disqus.
Previous: Write a query to display the salesmen which name are alphabetically lower than the name of the customers.
Next: Write a query to display all the orders that had amounts that were greater than at least one of the orders from October 9th 2012.
What is the difficulty level of this exercise?