One of the SQL questions recently asked in UST Global interview.
Given us cinemas_tbl, we need to display available seats which are in squence.
In order to solve this questions, we used LAG and LEAD Functions. You will understand how lag and lead functions works in this video.
Let us first create cinemas table
create table cinema_tbl (seat_id int, free int)
Insert the records
insert into cinema_tbl values (1,1),(2,0),(3,1),(4,0),(5,1),(6,1),(7,1),(8,0),(9,1),(10,1)
Follow us on
Instagram : instagram.com/cloudchallengers
Facebook : facebook.com/cloudchallengers
LinkedIn : linkedin.com/company/cloudchallengers
Негізгі бет UST Global SQL Interview Question - LAG & LEAD Functions
Пікірлер: 36