Complex SQL Questions for Interview Preparation

This playlist contains scenario based SQL problems. After solving these you should be able to ace any SQL interview. As and when I find a good problem, i will add it to this playlist.

Curated by: Ankit Bansal (96 videos)


Currently Playing: Leetcode Hard SQL Problem - 6 | Second Most Recent Activity | SQL Window Analytical Functions

In this video we will silve a leetcode hard problem 1369 . Where we need to find second most recent activity and if user has only 1 activoty then return that as it is. We will use SQL window functions to solve this problem. Here is the script: create table UserActivity ( username varchar(20) , activity varchar(20), startDate Date , endDate Date ); insert into UserActivity values ('Alice','Travel','2020-02-12','2020-02-20') ,('Alice','Dancing','2020-02-21','2020-02-23') ,('Alice','Travel','2020-02-24','2020-02-28') ,('Bob','Travel','2020-02-11','2020-02-18'); #sql #interview #window #functions #rank #count


Tracks in this Playlist