Write a

  Рет қаралды 783

The Big Data Show

The Big Data Show

Күн бұрын

Пікірлер: 5
@doyouwanttoknow3366
@doyouwanttoknow3366 5 ай бұрын
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 5 ай бұрын
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 5 ай бұрын
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 5 ай бұрын
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
Data Engineering Interview at top product based company | First Round
40:07
Job, Stage and Task in Apache Spark | PySpark interview questions
21:39
The Big Data Show
Рет қаралды 1,6 М.
Всё пошло не по плану 😮
00:36
Miracle
Рет қаралды 4,1 МЛН
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 86 МЛН
Unlocking Apache Kafka: The Secret Sauce of Event Streaming
17:17
The Big Data Show
Рет қаралды 868
What does a Data Analyst actually do? (in 2024) Q&A
14:27
Tim Joo
Рет қаралды 72 М.
What is topic, partition and offset in Kafka?
27:24
The Big Data Show
Рет қаралды 676
3 Solutions to a ITC Infotech SQL Interview Question
20:01
Ankit Bansal
Рет қаралды 12 М.
How I'd Learn Data Analytics in 2024 | 3 Month Plan
11:42
Rohan Adus
Рет қаралды 406 М.
Apache Spark End-To-End Data Engineering Project | Apple Data Analysis
3:01:19
Starting a Career in Data Science (10 Thing I Wish I Knew…)
10:42
Sundas Khalid
Рет қаралды 220 М.