You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
339 B
SQL

/*17. Write a query to find all the salesmen who worked for only one customer.*/
SELECT *
FROM salesman
WHERE salesman_id IN (
SELECT DISTINCT salesman_id
FROM customer a
WHERE NOT EXISTS (
SELECT * FROM customer b
WHERE a.salesman_id=b.salesman_id
AND a.cust_name<>b.cust_name));