12 lines
428 B
MySQL
12 lines
428 B
MySQL
|
/*6. Write a query to list all the salesmen, and indicate those who do not have customers in their cities, as well as whose
|
||
|
who do.*/
|
||
|
SELECT salesman.salesman_id, name, cust_name, commission
|
||
|
FROM salesman, customer
|
||
|
WHERE salesman.city = customer.city
|
||
|
UNION
|
||
|
SELECT salesman_id, name, 'NO MATCH', commission
|
||
|
FROM salesman
|
||
|
WHERE NOT city = ANY
|
||
|
(SELECT city
|
||
|
FROM customer)
|
||
|
ORDER BY 2 DESC;
|