KnowledgeBoat Logo
|

Informatics Practices

Consider following tables to answer below question :

Salesman (salesman_id, name, city, commission ) and

Customer (customer_id, cust_name, city, grade, salesman_id )

Write an SQL query to list all the salesmen who do not have customers in 'DELHI' and 'JAMMU'.

SQL Joins & Grouping

1 Like

Answer

SELECT s.name
FROM Salesman s
WHERE s.salesman_id NOT IN (
  SELECT DISTINCT c.salesman_id
  FROM Customer c
  WHERE c.city IN ('DELHI', 'JAMMU')
);

Answered By

1 Like


Related Questions