You are on page 1of 2

Birla Institute of Technology & Science, Pilani, K. K.

BIRLA Goa campus


Database Systems (CS F212)
Second Semester 2022-2023
Lab-3
Note: Upload your SQL queries in a short answer quiz on the link provided on Quanta.

Consider the following relational schema and answer the following questions:

Customers
customer_id customer_name contact_name address city postal_code country

Orders
order_id customer_id order_date

Products
product_id product_name unit_price

OrderDetails
order_id product_id quantity price

NOTE: The above is only for reference, students need not create/modify any tables.

Drop existing tables and import lab3.sql into the db212 database.

Q1. What are the customer names and order dates for all orders placed by customers from New
Delhi and Navi Mumbai? Write the query without nesting, ‘in/notin’, ‘and/or’ predicates. Hint:
Use set operations.

Q2. List the names of customers who have not placed any orders. Write the query without using
in/not in predicates.

Q3. Display all product details of the products ordered by both the customers, the one with id 1
and the one with id 2?
Q4. Write a SQL query to find the total revenue generated from each customer in the month of
January 2023. The query must return the customer ID and total revenue from each customer in
descending order of revenue.

Q5. Display the names of the customers who have placed an order for the product with
product_id=3?

Q6. List the product_id, quantity, and revenue of all the products that have revenue greater than
the average revenue of all products.

Q7. Find the total cost of each order of Hats. Include the product name, order ID, and total cost
in the results.

Q8. List all the contact names in descending order by the number of orders they have placed.
(Only if their respective customer has placed atleast one order)

Q9. List the order_id of orders where all ordered products have a unit price greater than $10.

You might also like