SQL Weekly Quiz 3
QUESTION 1
Dataset_Name: Transaction_Data
Q1. You have a table named Transaction_Data with columns transaction_date,
product_name, and quantity_sold.
Write a query to find the total quantity sold for each product on the latest transaction
date.
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
SOLUTION 1
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
Question 2
Dataset_Name: Transaction_Data
Q2. In the Transactions_Data table, there is a column named unit_price.
Write a query to calculate the cumulative revenue for each product over time, considering
the transaction date. Arrange the result by product and transaction date.
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
SOLUTION 2
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
Question 3
Dataset_Name (Sample): Orders
Q3. Write a SQL query to find the top 3 customers who have made the highest total
purchase amount.
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
SOLUTION 3
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
Question 4
Dataset_Name (Sample): Revenue
Q4. Write a SQL query to calculate the monthly growth rate of revenue. Display the month
revenue, and the percentage growth compared to the previous month.
Marks 10 Time 5Minutes
SQL Weekly Quiz 3
Solution 4
Dataset_Name (Sample): Revenue
Marks 10 Time 5Minutes
SQL Weekly Quiz 3
Question 5
Dataset_Name (Sample): Employees
Q5. Write a SQL query to identify and list all the duplicate names
(Combined first name and last name) in the employees table.
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
Solution 5
Dataset_Name (Sample): Employees
Marks 5 Time 3 Minutes
SQL Weekly Quiz 3
Question 6
Dataset_Name (Sample): Orders
Q6. Write a SQL query to find the top 2 customers with the highest average time
between consecutive orders.
Marks 10 Time 5 Minutes
SQL Weekly Quiz 3
Solution 6
Dataset_Name (Sample): Orders
Marks 10 Time 5 Minutes
SQL Weekly Quiz 3
Question 7
Dataset_Name (Sample): Products
Q7. Write a SQL query to find the category with the highest average discounted price for
products where the original price is greater than $75.
Marks 10 Time 5 Minutes
SQL Weekly Quiz 3
Solution 7
Dataset_Name (Sample): Products
Marks 10 Time 5 Minutes
SQL Weekly Quiz 3
Question 8
Dataset_Name (Sample): Employees
Q8. Write a SQL query to find the employees who have the highest salary within their
department and have been hired for more than 6 months.
Marks 15 Time 6 Minutes
SQL Weekly Quiz 3
Solution 8
Dataset_Name (Sample): Employees
SQL Weekly Quiz 3
Question 9
Dataset_Name (Sample): Sales
Q9. Write an SQL query to calculate the cumulative sum of quantities sold for each
product, resetting the sum for each change in the product.
Marks 15 Time 6 Minutes
SQL Weekly Quiz 3
Solution 9
Dataset_Name (Sample): Sales
SQL Weekly Quiz 3
Question 10
Table: Orders
Table: Customers
10. Write an SQL query to find the top 2 customers with the highest total amount of
orders, excluding customers from the USA, and whose registration date is within the last
year.
Marks 20 Time 8 Minutes
SQL Weekly Quiz 3
Solution 10