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.
13 lines
623 B
MySQL
13 lines
623 B
MySQL
5 years ago
|
/*Write a SQL statement to make a list for the salesmen who either work for one or more customers or yet to join any of the
|
||
|
customer. The customer, may have placed, either one or more orders on or above order amount 2000 and must have a grade, or
|
||
|
he may not have placed any order to the associated 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
|
||
|
WHERE c.purch_amt>=2000
|
||
|
AND a.grade IS NOT NULL;
|