EY SQL Interview Question Solved Step-by-Step

  Рет қаралды 70

The Data -Tech Club

The Data -Tech Club

Күн бұрын

Пікірлер: 2
@user-gq6cg3ls7f
@user-gq6cg3ls7f Күн бұрын
with cte as( select *, DATEADD(DAY, -1*ROW_NUMBER() over (partition by employee, status order by dates), DATES) FLAG from ATTENDANCE_TUE ), cte2 as( select *, FIRST_VALUE(DATES) over (partition by employee, FLAG order by DATES) start_date, FIRST_VALUE(DATES) over (partition by employee, FLAG order by DATES DESC) end_date from cte ) select distinct employee,start_date , end_date, status from cte2
@ishamajumdar5580
@ishamajumdar5580 Күн бұрын
My Approach : WITH cte AS ( SELECT *, DAY(dates) - ROW_NUMBER() OVER(PARTITION BY employee, status ORDER BY Dates) AS diff FROM attendance ORDER BY dates ) SELECT employee, MIN(dates) AS From_Date, MAX(dates) AS To_Date, status FROM cte GROUP BY employee, status, diff;
Learn 12 Basic SQL Concepts in 15 Minutes (project files included!)
16:48
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Group By + Order By in MySQL | Beginner MySQL Series
10:46
Alex The Analyst
Рет қаралды 153 М.
Learn SQL Basics in Just 15 Minutes!
16:57
Kenji Explains
Рет қаралды 197 М.
EY SQL Interview Question | Medium-level
21:33
Nishtha Nagar
Рет қаралды 10 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН