SQL Subquery Exercises: Display the salesmen which name are alphabetically lower than the name of the customers
SQL SUBQUERY: Exercise-21 with Solution
21. Write a query to display the salesmen which name are alphabetically lower than the name of the customers.
Sample table: Salesman
Sample table: Customer
SELECT * FROM salesman a WHERE EXISTS (SELECT * FROM CUSTOMER b WHERE a.name < b.cust_name);
salesman_id name city commission 5001 James Hoog New York 0.15 5002 Nail Knite Paris 0.13 5006 Mc Lyon Paris 0.14 5003 Lauson Hen San Jose 0.12
Contribute your code and comments through Disqus.
Previous: Write a query to find all the salesmen for whom there are customers that follow them.
Next: 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.
What is the difficulty level of this exercise?