SQL UNION Exercises: Display all salesmen and customer located in London
SQL UNION: Exercise-1 with Solution
1. Write a query to display all salesmen and customer located in London.
Sample table: Salesman
Sample table: Customer
SELECT salesman_id "ID", name, 'Salesman' FROM salesman WHERE city='London' UNION (SELECT customer_id "ID", cust_name, 'Customer' FROM customer WHERE city='London')
ID name ?column? 3001 Brad Guzan Customer 3008 Julian Green Customer 5005 Pit Alex Salesman
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?