Filter Bookings by Region
Imagine you're a regional manager at a hotel chain, and your job is to analyze bookings by location.
Right now, you need to generate a list of all bookings in New York state, so the marketing team can focus on targeting guests in that area.
To do this, you'll filter the dataset using the WHERE
clause, one of the most common tools in SQL for narrowing down rows based on conditions.
Task
From the bookings
table in the hotel_booking.sqlite
database, display:
hotel_name
city
state
Only include rows where the state
is 'NY'
.
How to solve it
Write a SQL query in the editor that returns only bookings made in New York state.
Use a WHERE
clause to filter the state
column so that only rows with 'NY'
are included.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.