programming-examples/sql/Joins/Write a SQL statement to make a list for the salesmen who works either for one or more customer or not yet join under any of the customers.sql
2019-11-18 14:05:53 +01:00

10 lines
465 B
SQL

/*Write a SQL statement to make a list for the salesmen who works either for one or more customer or not yet join under any of
the customers who placed either one or more orders or no order to their supplier.*/
SELECT a.cust_name,a.city,a.grade,
b.name AS "Salesman",
c.ord_no, c.ord_date, c.purch_amt
FROM customer a
RIGHT OUTER JOIN salesman b
ON b.salesman_id=a.salesman_id
RIGHT OUTER JOIN orders c
ON c.customer_id=a.customer_id;