Write SQL statements to find the following items based on sa
Write SQL statements to find the following items based on salesman/customer/order tables:
List of salesmen assigned to more than 10 customers along with number of assigned customers sorted in descending order.
Solution
SELECT s.name ,count(c.customer_id) from salesmen s,customer c,order o
WHERE s.salesmen_id = c.salesmen_id
AND c.salesmen_id = o.salesmen_id
AND count(s.customer_id) > 10
ORDER BY c.customer_id ASC;
