Consecutive Numbers | Leetcode 180 | Crack SQL Interviews in 50 Qs #mysql #leetcode

preview_player
Показать описание
Want to crack SQL interviews? Check out our latest video!!!

A 50-questions SQL study plan to ace any interview.
This tutorial will walk you through the solution in easy steps. This is an easy-level question from Leetcode.

Consistency is what transforms average into excellence.
So be consistent & keep Coding💻!!

Timecodes
0:00 - Introduction
0:28 - Question Explanation
1:11 - Understanding Concept with the help of Example
1:48 - Writing SQL Query
3:56 - Explanation of SQL Query
6:39 - Outro

Connect With Me -

#coding
#leetcode
#mysql
#sql
#interview
#sqlinterview
#sqlinterviewquestionsandanswers
#sql_server
#learnwithchirag
#consecutive
#numbers
#medium
Рекомендации по теме
Комментарии
Автор

Hey there! 👋 For more interesting content, tutorials, and updates, Feel free to connect with me on

Instagram Handles :-



Let's stay connected and keep the creativity flowing! 💡

learnwithchirag
Автор

Hello Sir,
In this, If we have given that appears num at-least 10 times or more then 10 times, then which approach will apply?

uncreativeovertake
Автор

select distinct num as ConsecutiveNums
from Logs
where (Id + 1, num) in (select * from Logs) and (Id + 2, num) in (select * from Logs)

ekdqdrj
Автор

select distinct num as ConsecutiveNums
from Logs
where id in (select id from logs where id =3 ) i try to do this but after 15 test case it doest not work
pls give advice where i mistake

MayankRathore-qiqv
Автор

Thanks and one suggestion is try to explain more on the logical part even if video gets long.

rishavraj
Автор

SELECT DISTINCT num AS ConsecutiveNums
FROM (
SELECT num,
LAG(num, 1) OVER (ORDER BY id) AS prev_num,
LEAD(num, 1) OVER (ORDER BY id) AS next_num
FROM Logs
) AS temp
WHERE num = prev_num AND num = next_num;

gautammakharia
Автор

Bhai pahale smajhaya jata hai fhir query likhte hai

adarshjha
Автор

bhai proper table pe query chala kar output compare karke bataya karo kuch animation add karke, Aise hawa me sql samajh nhi aati.

KatiyarArpit-qb
Автор

use group by l1.num for the submission or generalized answer

shivamshukla
join shbcf.ru