Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL QUERIES TO BE IMPLEMENTED FOR TESTING DATABASE ARE AS FOLLOWS : Identify the

ID: 3771332 • Letter: S

Question

SQL QUERIES TO BE IMPLEMENTED FOR TESTING DATABASE ARE AS FOLLOWS:

Identify the names of all customers whose age is 20.

Show the name of all the books with third edition from Inventory Database.

Print the name of customer and amount he paid for the books where the price of book is more than 500.

Show the names of unique customers.

Show the Customer ID, Customer Name, Order ID where Customer ID is 1 and Order ID is 2.

Print Order ID, Order Date and Customer ID for Customer ID 2.

Print all the data from Inventory Database.

Show Order Data, Book Name, Order ID for the orders made on or before 5 august 2015.

Show Cashier ID and Receipt ID for those books which price is more than 1000 and the book category is "Politics".

Print the total number of customers.

Find the Average price of books in the Inventory Database.

Show the total cost of all the books present in the Book store.

Explanation / Answer

1. Select * from Customer where age = 20;

2. Select name from Books where edition=3;

3.Select name, amount from customer, Books where Book.customer_id= customer.customer_id and book.price>500;

4. Select unique(name) from customer;

5. select customer_id, customer_name, order_id from customer where customer_id=1 and order_id=2;

6. Select Order_id, Order_date, customer_id from Customer where customer_id=2;;

7. Select * from Inventory.tables;

8. Select Order_date, title, order_id from Order where order_date<'5-08-2015;'

9. Select Cashier_ID, Receipt_ID from Books where price>1000 and category='Politics';

10.Select count(*) from Customer;

11. select avg(cost) from Books;

12. Select sum(cost) from Books;