Skip to content

1 or 2 credits, some free · 1 credit is about $1

pocketshelf

Hotel Bookings SQL: Reporting Queries

A 2-page snippet pack for reporting and analytics queries for a hotel bookings database (guests and bookings): 12 short entries with copy-ready code.

ForDevelopers

sql-reporting-queries-for-hotel-bookings.pdfShowing 20 of 78 lines
// bookings per month
SELECT date_trunc('month', check_in) AS month, count(*) AS bookings
FROM bookings
GROUP BY 1
ORDER BY 1;

// Top guests by nightly_rate
SELECT p.full_name, sum(c.nightly_rate) AS total
FROM guests p
JOIN bookings c ON c.guest_id = p.id
GROUP BY p.id, p.full_name
ORDER BY total DESC
LIMIT 10;

// Share by status
SELECT status, count(*) AS n,
       round(100.0 * count(*) / sum(count(*)) OVER (), 1) AS pct
FROM bookings
GROUP BY status
ORDER BY n DESC;

What's inside

Format
PDF, Markdown, SQL
Contents
12 queries
Version
1.0 · Updated 3 Oct 2026
Licence
Commercial What this means
Checked
Checked before it ships
  • sql-reporting-queries-for-hotel-bookings.pdfPDF · 20 KB
  • sql-reporting-queries-for-hotel-bookings.mdMarkdown · 3 KB
  • sql-reporting-queries-for-hotel-bookings.sqlSQL · 3 KB
  • LICENSE.txtadded to every download

About this item

A compact, printable snippet pack for reporting and analytics queries for a hotel bookings database (guests and bookings). Each of the 12 entries has a one-line explanation and a small example you can paste into your editor. The PDF uses a two-column A4 layout designed to sit next to your keyboard, and the same content ships as Markdown so you can search it or drop it into your notes, plus a .sql file with every query. Every SQL example targets PostgreSQL 16.

Reviews

No reviews yet.

You might also grab