No video

Write a

  Рет қаралды 704

The Big Data Show

The Big Data Show

3 ай бұрын

Пікірлер: 5
@doyouwanttoknow3366
@doyouwanttoknow3366 3 ай бұрын
With CTE as (select hotel_id, room_number, lead (room_number) over(order by room_number), lead (room_number) over(order by room_number) - room_number as difference from Hotels where availability_status = available) select hotel_id, room_number from CTE where difference = 1
@TheBigDataShow
@TheBigDataShow 3 ай бұрын
You are in right direction but there is a few improvement needed like applying Partition Byu on hotel_id and then applying lead() over(partition by hotel_id, order by room_number asc). Now there is one another catch here. For example: Let's consider following sample table. hotel_id, room_id, available status 1, 2, false 1, 3, true 1, 4, true 1, 5, true 2, 101, true 3, 1, true 3, 1, true So expected output should be hotel_id, room_id 1, 3 1, 4 1, 5 3, 1 3, 1 Now kindly check the solution that you have provided, You will able to debug your mistake
@Momofrayyudoodle
@Momofrayyudoodle 3 ай бұрын
lead(room_number) over (partition by hotel_id order by room_number) : Need to partition by hotel id to avoid mixing up the room ids of different hotels
@akskrish3924
@akskrish3924 2 ай бұрын
Need to filter out the room id which has single room ... to find that we need check with previous room id - current room id =1 or next available room id - current room id =1 under each hotel id. If any one of the condition satisfied then give it as a flag as consecutive_flag then fliter only flag=1 .. this will remove room id which are available as single room
SQL Query Optimization | SQL Query Optimization and performance tuning
10:16
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 10 МЛН
Кадр сыртындағы қызықтар | Келінжан
00:16
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 15 МЛН
👨‍🔧📐
00:43
Kan Andrey
Рет қаралды 10 МЛН
What does a Data Analyst actually do? (in 2024) Q&A
14:27
Tim Joo
Рет қаралды 45 М.
AI Expert Explains Future Programming Jobs… and Python
9:59
Travis Media
Рет қаралды 287 М.
Never focus on Data Analyst Job. Why?
14:18
ProITBridge
Рет қаралды 15 М.
What REALLY is Data Science? Told by a Data Scientist
11:09
Joma Tech
Рет қаралды 3,8 МЛН
What I *actually* do as a Data Scientist (salary, job, reality)
8:38
The Harsh Reality of Being a Data Engineer
14:21
Jash Radia
Рет қаралды 229 М.
Generative AI in a Nutshell - how to survive and thrive in the age of AI
17:57
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 10 МЛН