GuideIntermediate

Advanced Sql Querying

Learn to query a relational database with real SQL: JOINs in depth, aggregation, subqueries, CTEs (including recursive ones), window functions, and query optimization by reading the execution plan. You work on Reservo's database, a coworking room-booking system, and come out knowing how to answer complex business questions with a single query that's well written, readable, and efficient. It closes with a full analytical report: revenue by room and by month, top members by spend, occupancy, refund rate, and ranking.

64
lessons
8
modules
English · Spanish
available in
Yes
certificate
Free
access
NIEVA

Outcomes

What you'll be able to do

  • Go beyond the basic SELECT: expressions, aliases, and thinking of every query as a business question against Reservo's database
  • Master JOINs in depth: INNER JOIN, LEFT JOIN (and rows with no match), self-join, joining three or more tables, ON vs WHERE, and the cartesian product trap
  • Aggregate data with COUNT, SUM, AVG, MIN, and MAX, use GROUP BY and HAVING, and combine aggregates with JOINs
  • Write scalar subqueries, subqueries in WHERE with IN/EXISTS, subqueries in FROM as a derived table, and correlated subqueries — and decide when each beats a JOIN
  • Simplify complex queries with CTEs (WITH), chain them, and write recursive CTEs (WITH RECURSIVE) for hierarchies and series
  • Use window functions: OVER (PARTITION BY... ORDER BY...), ROW_NUMBER, RANK, DENSE_RANK, running totals, LAG/LEAD, and top-N per group
  • Read the execution plan with EXPLAIN QUERY PLAN, design indexes for queries, and avoid non-SARGable predicates and the N+1 pattern
  • Deliver Reservo's full analytical report: revenue by room and month, top members by spend, occupancy by room, refund rate, and ranking

Before you start

What you need to bring

It's for you if...

  • Devs and analysts who already know basic SELECT, WHERE, and ORDER BY and need to answer complex business questions with a single query
  • Anyone preparing for technical interviews that ask you to write JOINs, subqueries, CTEs, or window functions live
  • Backend devs who need to optimize slow queries by reading the execution plan
  • Data analysts who want to stop exporting to spreadsheets for what SQL already solves

Requirements and materials

  • Basic SQL: SELECT, WHERE, ORDER BY, LIMIT
  • Python 3 installed (the `sqlite3` module ships with the standard library; nothing else to install)
  • No prior experience with JOINs, subqueries, or window functions required

Content

The syllabus, module by module

Open any of them to see its lessons.

Where it fits

This guide is part of something bigger

It's studied inside these programs, with support and dates.

Common questions

What people usually ask

Start whenever you like

Reviews

What students say

These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.

No approved reviews yet.

Be the first to share your experience!