SQL Subquery Exercises: Find salesmen with all information who lives in the city where any of the customers lives
SQL SUBQUERY : Exercise-19 with Solution
19. Write a query to find salesmen with all information who lives in the city where any of the customers lives.
Sample table: Salesman
Sample table: Customer
SELECT * FROM salesman WHERE city=ANY (SELECT city FROM customer);
Output of the Query:
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.
What is the difficulty level of this exercise?