0% found this document useful (0 votes)
11 views8 pages

SQL Interview Questions For Data Science Question 3 1690137282

Uploaded by

Rudraksh Atreya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

SQL Interview Questions For Data Science Question 3 1690137282

Uploaded by

Rudraksh Atreya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Rudraksh Atreya

(SQL Interview Questions for


Data Science)

Swipe
Swipe
Tables:
Consider the following dataset
representing
1. Regions
Rudraksh Atreya
2. Products
3. Sales
in a retail company:

product_id name category


region_id region_name

1 T-shirt Clothing
1 East
2 Watch Accessories
2 West
3 Sneakers Footwear
3 North
4 Backpack Accessories

4 South
5 Jeans Clothing

Swipe
Tables:
Rudraksh Atreya
sale_id product_id region_id date quantity price_per_unit

1 1 1 2023-06-15 10 15.00

2 2 1 2023-06-15 5 25.00

3 1 2 2023-06-16 8 12.00

4 2 2 2023-06-16 3 30.00

5 3 2 2023-06-17 4 20.00

6 4 3 2023-06-17 6 18.00

7 5 3 2023-06-18 7 22.00

8 3 4 2023-06-18 2 28.00

Swipe
Your Task is to:
Rudraksh Atreya

1. Write an SQL query to find the top-selling


product in each region, along with the total
quantity sold and the total revenue generated
from its sales. Consider only products with sales
quantities greater than 5 and revenue greater
than $100. Sort the results by region ID in
ascending order.

Swipe
Expected
Output:
Rudraksh Atreya

region_id region_name top_product total_quantity_sold total_revenue

1 East T-shirt 10 150.00

2 West Watch 8 240.00

3 North Jeans 7 154.00

4 South Sneakers 6 108.00

Try yourself before you swipe

Swipe
Solution: Rudraksh Atreya

Swipe
Step by Step Explanation:
Rudraksh Atreya

1.

2.

3.

4.

5.

6.
7.

8.

Swipe
llo
Fo re!w Rudraksh Atreya

for m o
o

Connect for Mentorship


or any other Queries
topmate.io/rudraksh_atreya12

You might also like