Question: write the following queries: 1. Find OrderlD, Date, CustomerID, CustomerName, Address, Phone, Email of all orders. 2. List all orders of all customers including

write the following queries: 1. Find OrderlD, Date, CustomerID, CustomerName, Address, Phone, 

write the following queries: 1. Find OrderlD, Date, CustomerID, CustomerName, Address, Phone, Email of all orders. 2. List all orders of all customers including CustomerID, CustomerName, OrderlD, Date. Order the result by descending order of CustomerName (Note that we need to know also the customer who have no order). Try to use left outer join for this question. 3. Same as Question 2 but using right outer join for this exercise. 4. List CustomerID of all customers who have never bought any product. 5. Do the intersect between the list of CutomerID from Customers and the list of CustomerID from Orders? How many rows in the output? 6. Do the union between the list of CutomerID from Customers and the list of CustomerID from Orders? How many rows in the output? 7. Do the union all between the list of CutomerID from Customers and the list of CustomerID from Orders? How many rows in the output? 8. List all orders of 'NGUYEN THI BE' and 'LE VAN SANG', including CustomerID, CustomerName, OrderID, Date; ordered by CustomerName. 9. List OrderlD, ProductCode, ProductName, Price, SellPrice, SoldQuantity, Profit ((SellPrice - Price)*SoldQuantity) by ascending order of OrderID. 10. List CustomerID, CustomerName, OrderID, ProductCode, ProductName, Price, SellPrice, SoldQuantity, Profit (SellPrice - Price)*SoldQuantity) by ascending order of CustomerName. 11. List 5 Orderltems having the highest profit (profit = (SellPrice - Price)*SoldQuantity). 12. List all products (ProductCode, ProductName) bought by both 'NGUYEN THI BE' and 'MAI THI QUE ANH'. 13. List all products with highest price (Note that there could have many products with the highest price). You should not use the aggregate function max().

Step by Step Solution

3.56 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Find OrderlD Date CustomerID CustomerName Address Phone Email of all orders Select POOrderlDPODate... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!