Course · Intermediate · 8 h · Available in Spanish, English:
Analytical SQL: CTEs and window functions
Structure long queries as chained CTEs that read top to bottom and can be verified step by step
Build, milestone by milestone and using only SQL, the dashboard that a bike-sharing system's operations team checks every morning to decide where the rebalancing vans go. You work with synthetic data from a fictional city: stations, bikes, users, trips and docking events over five weeks. Your first query produces a dashboard figure within the first few minutes. Then you audit the source (trips with negative duration, trips with no end, duplicate stations) and build a clean-trips view that explains every exclusion. You model a small star-schema data mart and prove that it reconciles with the source. With chained CTEs and window functions you calculate trips by station and time band, each station's balance throughout the day, when it empties or fills up, the net flow between neighborhoods, the ranking of critical stations, cohort retention and the trend with a moving average. You justify an index by reading EXPLAIN and wrap up with an end-to-end reproducible script, a report with three rebalancing decisions and a challenge with a new question. Everything is done on the course page, in about 5 hours. Designed for those who already write JOIN, GROUP BY, CTEs and window functions and want a portfolio project built with SQL alone.
A sample lesson
-- Departures by neighborhood on Tuesday 2025-03-11, full day
SELECT e.barrio, COUNT(*) AS salidas
FROM viajes AS v
JOIN estaciones AS e ON e.estacion_id = v.estacion_origen_id
WHERE v.inicio >= DATE '2025-03-11'
AND v.inicio < DATE '2025-03-12'
GROUP BY e.barrio
ORDER BY salidas DESC, barrio;Available in: EN · ES
19 lessons and about 5 h 40 min of content. You go at your own pace, with no fixed dates.
By the end you will be able to: Audit a transactional source with queries that count, isolate and document every anomaly in a traceable view; Design a star schema with a declared grain and prove with a reconciliation that it neither loses nor duplicates trips; Chain CTEs to build metrics by station and time band that include the combinations with no activity.
Other courses, projects and specializations related to this content.
Course · Intermediate · 8 h · Available in Spanish, English:
Structure long queries as chained CTEs that read top to bottom and can be verified step by step
Course · Beginner · 7 h · Available in Spanish, English:
Filter and sort rows with SELECT, WHERE, ORDER BY, LIMIT, LIKE, IN, BETWEEN, and IS NULL.
Project · Intermediate · 7 h · Available in Spanish, English:
Turn a business opinion into a question with an explicit metric, comparison period and grain