SQL_Exercise1.pdf

SQL Exercise 1:

Name___________________Student No._______________________

Go to the following link and type SQL statements to finish the following questions.

https://www.w3schools.com/SQL/trysql.asp?filename=trysql_op_in

1) List full details of all customer whose country is UK.

2) List all products’ ID with their supplier ID and category ID.

3) List all shipper IDs in all orders.

4) List all shipper IDs in all orders, with duplicates eliminated.

5) Display the total quantity of product 51 in all orders.

6) List IDs and names for all customers whose first name in their contact name is ‘Elizabeth’.

7) List all suppliers in UK or USA.

8) List the IDs of all orders whose quantity is no less than 40.

9) List all products, arranged in descending order of price.

10) Produce a list of orders in order of quantity. If quantity is same for some orders, then sort by product ID.

11) Find how many products whose ID is 51 are ordered totally.

12) Find how many orders that ordered product 71.

13) Find the average price of the products in category 2.

14) Find how many products whose prices is between 10 and 30, and the sum of their prices.

15) Find the number of orders placed in August 1996.

16) List the details of the most expensive product in category 2.

17) Find the highest price, the lowest price, and the average price of products in category 3.

18) Find the number of USA suppliers.

19) Find how many orders are shipped by shipper 2 in 1997.

20) Find the details of the order that has the minimum quantity.