Lecture
Filter Bookings by Region
Imagine you're a regional manager at a hotel chain, and your task is to analyze bookings by location.
You need to create a list of all bookings made in New York state, so the marketing team can focus on guests from that region.
To do this, you’ll use the WHERE clause — one of SQL’s most common tools for filtering rows based on specific conditions.
Task
From the bookings table in the hotel_booking.sqlite database, display:
hotel_namecitystate
Only include rows where the state is 'NY'.
How to solve it
Write a SQL query that returns only bookings made in New York state.
Use a WHERE clause to filter the state column so only rows with 'NY' appear in your results.
Lessons in this chapter · Solve real-world problems with SQL.
- 1. Filter Bookings by Region
- 2. Sort and Limit Recent Reservations
- 3. Use Logical AND/OR to Filter Hotel Data
- 4. Count Transactions by Customer
- 5. Calculate Average Spending per Client
- 6. Filter Customers with High Transaction Totals
- 7. Join Flights with Passengers
- 8. List Passengers with No Reservations
- 9. Find Customers with High-Priced Ticket Purchases
- 10. Filter Events with Above-Average Ticket Sales
sqlQuiz
?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help