Wednesday, 8 August 2012

SQL QUESTION 3


The management of the shoe factory wants a report of orders which lists three
columns: Order_No, corresponding customer name, and phone number.

SELECT order_no , name, phone
FROM orders, customers
WHERE orders.cust_code = customers.cust_code;
  
The management wants a four-column report containing order_no, order_qty,name of the corresponding shoe and its cost. -

SELECT order_no , Order_Qty, name, cost
FROM orders, shoes WHERE Shoe_Code = code;

.The management wants the names of customers who have placed any order of quantity more than 300. -

SELECT name, address FROM orders, customers
WHERE orders.cust_code = customers.cust_code
and order_qty > 300;

The management wants a report in which with each Order_No management needs name of the corresponding customer and also the total cost (Order quantity x Cost of the shoe) of the order are shown. -



SELECT order_no, Order_Qty, customers.name,

cost*order_qty as 'Order Cost'
FROM orders, shoes, Customers
WHERE Shoe_Code = code
and Orders.Cust_Code = Customers.Cust_Code
order by order_no;

No comments:

Post a Comment