0% found this document useful (0 votes)
1 views

SQL Questions CTEs nad Windows Functions

The document contains a series of medium difficulty SQL interview questions authored by Abhinav Singh. It includes queries to find top products by revenue, identify employees with increasing sales, determine the third lowest price in product categories, find customers with the highest purchase amounts by region, and calculate year-over-year sales growth. Each question is accompanied by a brief description of the relevant database schema.
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)
1 views

SQL Questions CTEs nad Windows Functions

The document contains a series of medium difficulty SQL interview questions authored by Abhinav Singh. It includes queries to find top products by revenue, identify employees with increasing sales, determine the third lowest price in product categories, find customers with the highest purchase amounts by region, and calculate year-over-year sales growth. Each question is accompanied by a brief description of the relevant database schema.
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/ 6

SQL

INTERVIEW
QUESTIONS DIFFICULTY - MEDIUM

ABHINAV SINGH
Question 1.

Write a query to find the top 5 products with the highest revenue in each
category.
Products Sales
ProductID: INT SaleID: INT
Name: VARCHAR(100) ProductID: INT
CategoryID: INT Amount: DECIMAL(10, 2)

Solution :

ABHINAV SINGH
Question 2.

Identify Employees with Increasing Sales for Four Consecutive


Quarters
Sales
EmployeeID: INT
SaleDate: DATE
Amount: DECIMAL(10, 2)

Solution :

ABHINAV SINGH
Question 3.

Find the Third Lowest Price for Each Product Category


Products
ProductID: INT
Name: VARCHAR(100)
CategoryID: INT
Price: DECIMAL(10, 2)

Solution :

ABHINAV SINGH
Question 4.

Write a query to find the customer with the highest total purchase
amount in each region.
Customers Orders
CustomerID: INT OrderID: INT
Name: VARCHAR(100) CustomerID: INT
Region: VARCHAR(50) Amount: DECIMAL(10, 2)

Solution :

ABHINAV SINGH
Question 5.

Calculate the Year-Over-Year Growth in Sales

Sales
SaleID: INT
SaleDate: DATE
Amount: DECIMAL(10, 2)

Solution :

ABHINAV SINGH

You might also like