Back to Browse

Find Employees with Consecutive Sick Leaves Using SQL | Real-Life SQL Interview Scenario

104 views
Dec 20, 2024
9:28

In this video, we solve an intermediate SQL interview scenario: identifying employees who have taken more than 3 consecutive sick leaves within the last 3 months and belong to a specific department. Learn how to design efficient SQL queries using window functions and filtering conditions to handle real-world datasets. Perfect for data analysts, data engineers, and data scientists preparing for job interviews. Watch now to master SQL problem-solving! #sqlserver #sqlquery #whatissql #sqldatabase #oracle #oraclesql #SQLtutorialforbeginners #learnSQLfromscratch #SQLfromzerotohero #SQLbasicstoadvanced #SQLqueries #SQLfordataanalysis #SQLjoinsexplained #SQLsubqueriestutorial #SQLaggregationfunctions #SQLinterviewquestions #SQLrealworldexamples #SQLmasterclass #SQLtutorial2024 #learnSQLfast #SQLfordatascience #SQLbeginnertoexpert drop table if exists Employee drop table if exists Attendance CREATE TABLE Employee ( EmployeeID INT PRIMARY KEY, EmployeeName NVARCHAR(50), DepartmentID INT ); INSERT INTO Employee (EmployeeID, EmployeeName, DepartmentID) VALUES (1, 'Alice', 101), (2, 'Bob', 102), (3, 'Charlie', 101), (4, 'Diana', 103), (5, 'Eve', 101); CREATE TABLE Attendance ( AttendanceID INT PRIMARY KEY, EmployeeID INT, Date DATE, AttendanceStatus NVARCHAR(10) ); INSERT INTO Attendance (AttendanceID, EmployeeID, Date, AttendanceStatus) VALUES (1, 1, '2024-09-01', 'Present'), (2, 1, '2024-09-02', 'Sick'), (3, 1, '2024-09-03', 'Sick'), (4, 1, '2024-09-04', 'Sick'), (5, 1, '2024-09-05', 'Sick'), (6, 1, '2024-09-06', 'Present'), (7, 2, '2024-09-01', 'Sick'), (8, 2, '2024-09-02', 'Sick'), (9, 2, '2024-09-03', 'Sick'), (10, 2, '2024-09-04', 'Present'), (11, 3, '2024-09-01', 'Present'), (12, 3, '2024-09-02', 'Absent'), (13, 3, '2024-09-03', 'Sick'), (14, 3, '2024-09-04', 'Present'), (15, 5, '2024-09-01', 'Sick'), (16, 5, '2024-09-02', 'Sick'), (17, 5, '2024-09-03', 'Sick'), (18, 5, '2024-09-04', 'Present');

Download

0 formats

No download links available.

Find Employees with Consecutive Sick Leaves Using SQL | Real-Life SQL Interview Scenario | NatokHD