Тёмный

LEAD & LAG in SQL | Analytical Functions Advanced SQL | Ashutosh Kumar 

Ashutosh Kumar
Подписаться 18 тыс.
Просмотров 9 тыс.
50% 1

Sql one of the most important language asked in most of the analytics interviews,in this series i have discussed some advanced level sql concepts that are frequently asked in data analyst,business analyst interviews. In this video i have covered lead lag functions concepts in sql which comes in window functions.
👉 Link to excel file -
github.com/ashutoshkr103/Micr...
#code for 1st table
drop table if exists details;
CREATE TABLE details(train_no INT, station VARCHAR(200), Timing TIME);
INSERT INTO details(train_no , station , Timing)
VALUES(22863,'Howrah','10:50:00'),
(22863 ,'Kharagpur','12:30:00'),
(22863 ,'Balasore','13:52:00'),
(22863 ,'Cuttack','15:47:00'),
(22863 ,'Bhubaneswar','16:25:00'),
(12262 ,'Howrah','05:45:00'),
(12262 ,'Tatanagar','09:00:00'),
(12262 ,'Bilaspur','15:05:00'),
(12262 ,'Raipur','16:37:00'),
(12262 ,'Nagpur','20:55:00');
select * from details;
👉 Complete playlist on Sql Interview questions and answers
• HackerRank SQL problem...
---------------------------------------------------------------------------------------------------------------------
Check out some more relevant content here
👉 How to Learn SQL
• How to learn sql for b...
👉 How to become a business analyst complete roadmap-
• Business Analyst Compl...
👉 How to become a data analyst complete roadmap-
• Data Analyst Complete ...
👉 Top 3 you tube channels to learn sql for free for beginners
• Video
👉 Rank ,Dense Rank, Row Number in sql -
• RANK - DENSE RANK - RO...
👉 Cross join in sql
• CROSS JOIN SQL
👉 union join in sql
• UNION IN SQL
👉 left join in sql
• LEFT JOIN IN SQL
👉 Right join in sql
• RIGHT JOIN IN SQL
👉 Inner join in sql
• INNER JOIN IN SQL
👉 Introduction to tables and databases in sql -
• INTRO TO TABLES AND DA...
👉 Aggregate Function in sql
• AGGREGATE FUNCTION IN SQL
👉 Functions in sql-
• IMPORTANT FUNCTIONS IN...
👉 String Function in sql
• STRING FUNCTIONS IN SQL
👉 CRUD operations in sql
• CREATE- READ- UPDATE-D...
👉 Autoincrement in sql
• Auto Increment in SQL ...
👉 Primary Key in sql-
• PRIMARY KEYS IN SQL - SQL
👉 Null and Default values in sql-
• NULL AND DEFAULT VALUE...
👉 Data types in sql-
• Data types in Sql - SQL
____________________________________________________________________
Fill the form below to subscribe yourself to the analytics jobs mailing list to receive regular job opening updates - docs.google.com/forms/d/e/1FA...
Why you should definitely fill the analytics job updates google form - • Job Openings into busi...
_______________________________________________________________________
Connect with me
📸Instagram - / ashutosh.analytics
💻Linkedin- / ashutoszh
_____________________________________________________________________
Comment down if you have any doubts
Please leave a LIKE 👍 and SUBSCRIBE ❤️ to my channel to receive more amazing content in data analytics and data science.
_____________________________________________________________________
🏷️ Tags
sql,
sql for data science,
sql for data analytics,
sql practise questions,
sql practise questions and solutions,
sql tutorials for beginners,
sql problems for data engineers,
ashutosh,
ashutosh kumar,
ashutosh kumar analytics,
sql problems easy,
sql problem medium,
sql problems hard,
sql window functions,
sql advanced questions,
rank functions in sql,
lag lead in sql,
sql interview questions and answers,
sql interview questions,
sql questions asked in interviews,
hackerrank sql solutions,
hackerearth sql solutions,
leetcode sql solution
🏷️HashTags
#sql #interviews #questions #solutions

Опубликовано:

 

14 июл 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 40   
@vijaykrishnachari3175
@vijaykrishnachari3175 11 месяцев назад
you are putting a lot of effort to taught us..kudos to you dear..god bless you with health and wealth...
@AshutoshKumaryt
@AshutoshKumaryt 11 месяцев назад
Thanks
@AshutoshKumaryt
@AshutoshKumaryt Год назад
👉 SQL Portfolio Project Indian Census- Part 1 ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-I3YvjFfn478.html 👉 Advanced Sql Concepts Complete Playlist ru-vid.com/group/PLbTF1OfX62c3RQ_ZFfyNBWVPdz_OWTMLG
@prachitamta4098
@prachitamta4098 Год назад
Thank you Ashutosh.
@analyticstamizan677
@analyticstamizan677 Год назад
Thanks for the clear Explanation bro..
@Gurjar01
@Gurjar01 10 месяцев назад
Bro ek hi baat bolunga yaar Ki aap kitni tassali se padhate ho, ek ek concept clear ho gya! Bro, You are jam ♥️
@AshutoshKumaryt
@AshutoshKumaryt 10 месяцев назад
Thxx
@onkarjoshi8811
@onkarjoshi8811 7 месяцев назад
SELECT TIMEDIFF(end_time_column, start_time_column) AS time_difference FROM your_table; use this from getting difference
@user-og6np6ro4h
@user-og6np6ro4h 4 месяца назад
Hi Ashutosh Thank you for sharing such videos. Wanted to ask why ain’t we using rows between function while calculating lead values. As you mentioned in the previous videos that we need to use rows between function when we use partition by. Please clarify
@AshutoshKumaryt
@AshutoshKumaryt 4 месяца назад
There is no hard and fast rule of applying rows between, as per the problem we are solving we need to apply I mean both are totally different things and does not go hand in hand
@gargshashank555
@gargshashank555 11 месяцев назад
Hi Ashutosh, first of all this is great series. Thank you so much for guiding us. I want to ask one question, As given in the last question that fetch those queries where the runs have been increased for the continuously 3 years. If 5 was given in place of 3, So how can we write the query to find those runs whose are increasingly continuously by 5 years? Looking forward to hear from you! Thanks in advance.
@AshutoshKumaryt
@AshutoshKumaryt 11 месяцев назад
can u elaborate
@user-lm5wb8vi1x
@user-lm5wb8vi1x 2 месяца назад
finished watching
@sabyasachiojha3723
@sabyasachiojha3723 Год назад
Hi bro excellent content,...but am unable to download the xlsx file from the github link!!! can you pls look into this
@harshkhola921
@harshkhola921 5 месяцев назад
in mysql it's timediff(t1,t2)
@mcdolla7965
@mcdolla7965 Год назад
BHT SAHI H SIR...ADVANCE EXCEL KA BHI PADHA DIJIYE SIR PLS
@AshutoshKumaryt
@AshutoshKumaryt Год назад
Covered Kiya h na playlist me
@smonica8364
@smonica8364 3 месяца назад
try to write query in a way that it will be completely visible, at present only half query is visible, it is difficult to understand it in one go.
@AshutoshKumaryt
@AshutoshKumaryt 3 месяца назад
I will work on this
@jeet9074
@jeet9074 3 месяца назад
why we used a in the last at 22:55
@AshutoshKumaryt
@AshutoshKumaryt 3 месяца назад
A is the name of Subquery
@vishvadeepmohanpandey129
@vishvadeepmohanpandey129 Год назад
what about the year 2008 for which Rohit has scored more runs than in year 2009 ,
@kishanbhise4733
@kishanbhise4733 6 месяцев назад
I'm searching for that particular video but struggling to find it. It will be great if you could explain that calculation in this video only. Video would be 10 mins lengthy but this would be a great video had you included the content of that particular video
@AshutoshKumaryt
@AshutoshKumaryt 6 месяцев назад
what exactly ?
@s.m.shreyas918
@s.m.shreyas918 Год назад
sir in this train timing analysis , i thought of some issue...c you did min of time so yu r getting oldest time of the table , but what when the train is being travelling over nights ,then dates changes so will it work then?, in pandas by using date time package that can be figured out anyway, but how to tackle that in sql.. kindly reply, if possible
@AshutoshKumaryt
@AshutoshKumaryt Год назад
hey great observation , what's your ttry?
@s.m.shreyas918
@s.m.shreyas918 Год назад
@@AshutoshKumaryt actually sir in sql you cannot create a column which only have time, yeah ofcourse you can create but for that column varchar2 dtype can be used, but if you want to save it as datetime timestamp then you must have date as well as time. so at that time i simply created the column as varchar2, and as per the concern if train travelling have multiple dates, i.e started on some day and arriving on another day like that.. in that case you must have the complete date time stamp,where the difference would give you results in number of days. i hope im making sense
@Shikimori-kw8xq
@Shikimori-kw8xq Год назад
hii sir the code written at 12:18 is not shown full, and also in time difference video full code is not covered, what all are that floor, %86400 and nested query. i didnt get it fully
@shrutibajaj7249
@shrutibajaj7249 8 месяцев назад
@samaramu32 1min=60 secs, then 60 mins = 1hr = 3600 secs, so, 24 hrs = 24*3600 secs = 86400 secs
@sarthaksatapathy7222
@sarthaksatapathy7222 Год назад
where is the video for time difference?plz send me the link?
@AshutoshKumaryt
@AshutoshKumaryt Год назад
Here it is ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rIPFBsZZ-MI.html
@user-lm5wb8vi1x
@user-lm5wb8vi1x 2 месяца назад
please provide the link for the cricket dataset. I am unable to find
@AshutoshKumaryt
@AshutoshKumaryt 2 месяца назад
Check description box
@priya-yb8mh
@priya-yb8mh 11 месяцев назад
Bro we can use TimeDiff() function for 2)elapse time till now.
@AshutoshKumaryt
@AshutoshKumaryt 11 месяцев назад
Yes
@smonica8364
@smonica8364 3 месяца назад
introduction opening music is unpleasant, noisy
@AshutoshKumaryt
@AshutoshKumaryt 3 месяца назад
Sorry for this
@shivamahuja9650
@shivamahuja9650 Год назад
where is the video for time difference?plz send me the link?
@AshutoshKumaryt
@AshutoshKumaryt Год назад
Hi here it is ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rIPFBsZZ-MI.html
@shivamahuja9650
@shivamahuja9650 Год назад
@@AshutoshKumaryt thank you sir
Далее
ШАР СКВОЗЬ БУТЫЛКУ (СКЕРЕТ)
00:46
CTE s IN SQL | Advanced SQL | Ashutosh Kumar
26:29
Просмотров 7 тыс.