programming-examples/sql/QueryMultipleTables/Write a SQL statement that produces all orders with the order number, customer name, commission rate and earned commission amount for those customers.sql

8 lines
484 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a SQL statement that produces all orders with the order number, customer name, commission rate and
earned commission amount for those customers who carry their grade more than 200 and served by an existing salesman.*/
SELECT ord_no, cust_name, commission AS "Commission%",
purch_amt*commission AS "Commission"
FROM salesman,orders,customer
WHERE orders.customer_id = customer.customer_id
AND orders.salesman_id = salesman.salesman_id
AND customer.grade>=200;