Leetcode SQL Problem | Second Most Recent Activity #sql #interview #windows

preview_player
Показать описание
In this video we will solve a leetcode problem, Where we need to find second most recent activity and if user has only 1 activity then return that as it is.

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 #function #rank #count

Connect with me on the below platforms-
Рекомендации по теме
Комментарии
Автор

Create table and insert data sql command mentioned in description

lakshaywadhwa
visit shbcf.ru