SQL Interview Question: Find Top 3 Salespersons Per Department | Intermediate Scenario
Автор: Analytics Hub
Загружено: 2024-12-11
Просмотров: 37
🎯 Ace Your SQL Interview!
In this video, we tackle a classic intermediate-level SQL interview question: How to find the top 3 salespersons per department based on their sales performance?
This step-by-step tutorial covers:
✅ Problem breakdown and key challenges.
✅ Tips to solve using SQL window functions (RANK() and PARTITION BY).
✅ Creating tables and inserting sample data.
✅ Writing the solution query and explaining it in detail.
Whether you're a Data Analyst, Data Engineer, or Data Scientist, this real-world scenario will boost your SQL problem-solving skills and prepare you for technical interviews!
👩💻 Topics Covered:
SQL Table Creation
Ranking Salespersons with Window Functions
Filtering Data for Top Performers
Query Optimization Tips
👉 Follow this series for more SQL interview questions and scenarios designed to help you stand out in your career!
🔔 Subscribe now and never miss an episode!
#sqlserver
#sqlquery
#whatissql
#sqldatabase
#oracle
#oraclesql
#SQLtutorialforbeginners
#learnSQLfromscratch
#SQLfromzerotohero
#SQLbasicstoadvanced
#SQLqueries
#SQLfordataanalysis
#SQLjoinsexplained
#SQLsubqueriestutorial
#SQLaggregationfunctions
#SQLinterviewquestions
#SQLrealworldexamples
#SQLmasterclass
#SQLtutorial2024
#learnSQLfast
#SQLfordatascience
#SQLbeginnertoexpert
CREATE TABLE Department1 (
DeptID INT PRIMARY KEY,
DeptName VARCHAR(50)
);
CREATE TABLE Salesperson (
SalesID INT PRIMARY KEY,
Name VARCHAR(50),
DeptID INT,
SalesAmount DECIMAL(10, 2),
FOREIGN KEY (DeptID) REFERENCES Department1(DeptID)
);
-- Insert into Department
INSERT INTO Department1 (DeptID, DeptName)
VALUES
(1, 'Electronics'),
(2, 'Clothing'),
(3, 'Furniture');
-- Insert into Salesperson
INSERT INTO Salesperson (SalesID, Name, DeptID, SalesAmount)
VALUES
(101, 'Alice', 1, 5000.00),
(102, 'Bob', 1, 7000.00),
(103, 'Charlie', 1, 3000.00),
(104, 'David', 1, 6000.00),
(105, 'Eva', 2, 8000.00),
(106, 'Frank', 2, 2000.00),
(107, 'Grace', 2, 9000.00),
(108, 'Helen', 3, 4000.00),
(109, 'Ian', 3, 4500.00),
(110, 'Jack', 3, 3500.00);
select * from Department1;
select * from Salesperson;
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: