LAG() and LEAD() in SQL | Part 10 | Data Science Interview Questions

Published: 16 June 2021
on channel: The Data Monk
2,168
37

This video shows the working of lead and lag functions. LEAD function is used to fetch the subsequent row data according to the given offset value. Similarly, the LAG function is used to fetch the previous row data according to the given offset value.

SYNTAX –
LEAD(ColName, Offset Value, DefaultValue) OVER (ORDER BY ColName1,ColName2..)
LAG(ColName, Offset Value, DefaultValue) OVER (ORDER BY ColName1,ColName2….)

where, Offset Value is no. of rows to lead or lag.
Default Value is if no of rows go first or last row, null will be the default value.

For better understanding , watch the video!
Website - https://thedatamonk.com/
SQL Complete Playlist -    • SQL Data Science Interview Questions  
Case Study Complete Playlist -    • Case Studies, Guesstimates and Data Scienc...  
We at The Data Monk aims at bridging the gap between theoretical knowledge and cracking an interview in Analytics domain.
Analytics domain includes:-
-Data Analysts
-Data Scientists
-Business Analysts
-Product Analysts
-Decision Scientists and similar roles

We currently have 30+ e-books on Amazon to prepare for Data Science interviews
You can also buy our set 10 e-books which covers 1400+ solved Interview Questions from here - https://thedatamonk.com/buy-e-books/
Please check our free resources:-
30+ companies complete interview questions - https://thedatamonk.com/analytics-int...
300+ Solved Python Questions - https://thedatamonk.com/python-questi...
300+ Solved SQL Questions - https://thedatamonk.com/sql-interview...
100+ Solved Case Studies and Guesstimates - https://thedatamonk.com/case-study-fo...
100+ Solved Interview Questions in R - https://thedatamonk.com/r-interview-q...
300 + Solved Machine Learning and Statistics Questions - https://thedatamonk.com/most-asked-ma...
200+ Solved Statistics Interview Questions - https://thedatamonk.com/statistics-da...
You can create your account on https://thedatamonk.com and participate in our Daily Quizzes and weekly free e-book giveaway by creating an account and subscribing to the website -https://thedatamonk.com/the-data-monk...


On this page of the site you can watch the video online LAG() and LEAD() in SQL | Part 10 | Data Science Interview Questions with a duration of hours minute second in good quality, which was uploaded by the user The Data Monk 16 June 2021, share the link with friends and acquaintances, this video has already been watched 2,168 times on youtube and it was liked by 37 viewers. Enjoy your viewing!