SQL UNION Exercises: Display distinct salesman and their cities
SQL UNION: Exercise-2 with Solution
2. Write a query to display distinct salesman and their cities.
Sample table: Salesman
Sample table: Customer
SELECT salesman_id, city FROM customer UNION (SELECT salesman_id, city FROM salesman)
salesman_id city 5001 New York 5002 London 5002 California 5006 Paris 5007 Rome 5002 Paris 5005 London 5003 Berlin 5007 Moscow 5003 San Jose
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?