TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2619 2.23K
๐Ÿš€ SQL Project Series #18

Hotel Booking Analytics ๐Ÿจ

Analyze hotel bookings, guests, rooms, payments, and occupancy trends using SQL to improve revenue, customer satisfaction, and operational efficiency.

๐ŸŽฏ Business Objectives
โœ… Track hotel bookings
โœ… Monitor room occupancy
โœ… Analyze guest demographics
โœ… Measure booking cancellations
โœ… Evaluate room performance
โœ… Analyze revenue trends
โœ… Optimize pricing strategy
โœ… Build hotel management dashboards

๐Ÿ“‚ Step 1: Create Database
CREATE DATABASE hotel_booking_db;
USE hotel_booking_db;

๐Ÿ“‚ Step 2: Create Guests Table
CREATE TABLE guests (
guest_id INT PRIMARY KEY,
guest_name VARCHAR(100),
gender VARCHAR(10),
city VARCHAR(50),
check_in_date DATE,
check_out_date DATE
);

๐Ÿ“‚ Step 3: Create Rooms Table
CREATE TABLE rooms (
room_id INT PRIMARY KEY,
room_type VARCHAR(50),
room_price DECIMAL(10,2),
room_status VARCHAR(20)
);

๐Ÿ“‚ Step 4: Create Bookings Table
CREATE TABLE bookings (
booking_id INT PRIMARY KEY,
guest_id INT,
room_id INT,
booking_date DATE,
booking_status VARCHAR(20),
payment_amount DECIMAL(10,2),
FOREIGN KEY (guest_id) REFERENCES guests(guest_id),
FOREIGN KEY (room_id) REFERENCES rooms(room_id)
);

๐Ÿ“‚ Step 5: Insert Sample Guests
INSERT INTO guests VALUES
(1,'Rahul Sharma','Male','Mumbai','2025-01-10','2025-01-13'),
(2,'Priya Verma','Female','Delhi','2025-01-12','2025-01-15'),
(3,'Amit Patel','Male','Pune','2025-01-14','2025-01-16'),
(4,'Sneha Joshi','Female','Bangalore','2025-01-15','2025-01-18'),
(5,'Rohan Gupta','Male','Hyderabad','2025-01-18','2025-01-20');

๐Ÿ“‚ Step 6: Insert Sample Rooms
INSERT INTO rooms VALUES
(101,'Standard',3000,'Occupied'),
(102,'Deluxe',5000,'Available'),
(103,'Suite',8500,'Occupied'),
(104,'Standard',3000,'Available'),
(105,'Deluxe',5000,'Occupied');

๐Ÿ“‚ Step 7: Insert Sample Bookings
INSERT INTO bookings VALUES
(1001,1,101,'2025-01-05','Confirmed',9000),
(1002,2,102,'2025-01-06','Confirmed',15000),
(1003,3,103,'2025-01-07','Cancelled',0),
(1004,4,104,'2025-01-08','Confirmed',9000),
(1005,5,105,'2025-01-10','Confirmed',10000);

๐Ÿง  SQL Concepts You'll Practice
โœ” DDL & DML
โœ” Joins
โœ” Aggregate Functions
โœ” GROUP BY
โœ” HAVING
โœ” CASE WHEN
โœ” Date Functions
โœ” CTEs
โœ” Window Functions
โœ” Ranking Functions

๐Ÿ“Š Business KPIs You Can Build
๐Ÿ“ˆ Total Bookings
๐Ÿ“ˆ Confirmed Bookings
๐Ÿ“ˆ Cancelled Bookings
๐Ÿ“ˆ Booking Cancellation Rate
๐Ÿ“ˆ Total Revenue
๐Ÿ“ˆ Average Booking Value
๐Ÿ“ˆ Average Length of Stay
๐Ÿ“ˆ Occupancy Rate
๐Ÿ“ˆ Revenue by Room Type
๐Ÿ“ˆ Revenue by Month
๐Ÿ“ˆ Room Utilization
๐Ÿ“ˆ Available vs Occupied Rooms
๐Ÿ“ˆ Most Popular Room Type
๐Ÿ“ˆ Guest Retention Rate
๐Ÿ“ˆ Repeat Guests
๐Ÿ“ˆ Peak Booking Days
๐Ÿ“ˆ Seasonal Booking Trends
๐Ÿ“ˆ City-wise Guest Distribution
๐Ÿ“ˆ Customer Lifetime Value
๐Ÿ“ˆ Executive Hotel Dashboard

๐ŸŽฏ This project reflects real-world SQL analysis performed by Hotel Revenue Analysts, Hospitality Analysts, Operations teams, and Business Intelligence professionals to optimize occupancy, pricing, and customer experience.

๐Ÿ’ก Double Tap โค๏ธ For More
  • โค 6
More from @sqlanalyst
  1. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  2. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  3. Oct 7, 2026SQL Interview Series โ€” Part 4 ๐Ÿ“Œ Question 4: Find the Highest Salary in Each Department Suโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Sep 29, 2026SQL Interview Series โ€” Part 2 ๐Ÿ“Œ Question 2: Find Duplicate Records Suppose you have an Emโ€ฆ
  6. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’