SQL Subquery Exercises: Display the salesmen for whom there are customers that follow them
SQL SUBQUERY: Exercise-20 with Solution
20. Write a query to find all the salesmen for whom there are customers that follow them.
Sample table: Salesman
Sample table: Customer
SELECT * FROM salesman WHERE city IN (SELECT city FROM customer);
salesman_id name city commission 5001 James Hoog New York 0.15 5002 Nail Knite Paris 0.13 5005 Pit Alex London 0.11 5006 Mc Lyon Paris 0.14
Contribute your code and comments through Disqus.
Previous: Write a query to find salesmen with all information who lives in the city where any of the customers lives.
Next: Write a query to display the salesmen which name are alphabetically lower than the name of the customers.
What is the difficulty level of this exercise?