SQL Playground — Week 9: SQL for Analytics

A real PostgreSQL database running in your browser (no server, nothing to install). It is seeded with a small nyc_taxi.raw_trips and nyc_taxi.raw_zones sample so you can try the joins, aggregations, CTEs, validation checks, and views from this week and see real result sets.

Booting PostgreSQL in your browser…
Schema & seed data

nyc_taxi.raw_trips — one row per taxi trip (~160 rows in this sample).

ColumnTypeDescription
vendor_idintTaxi company that recorded the trip (1 or 2).
pickup_datetimetimestampWhen the meter started.
dropoff_datetimetimestampWhen the meter stopped.
passenger_countintNumber of passengers (1–4).
trip_distancenumericTrip length in miles.
pickup_location_idintZone where the trip started. Joins to nyc_taxi.raw_zones.location_id.
dropoff_location_idintZone where the trip ended. Joins to nyc_taxi.raw_zones.location_id.
fare_amountnumericBase fare in dollars.
tip_amountnumericTip in dollars.
payment_typeint1=card, 2=cash, 3/4=other.

nyc_taxi.raw_zones — one row per location (~30 NYC zones across Manhattan, Brooklyn, Queens, the Bronx, Staten Island, and the airports).

ColumnTypeDescription
location_idintPrimary key. Referenced by both ID columns in nyc_taxi.raw_trips.
boroughtextNYC borough the zone sits in.
zonetextHuman-readable zone name (e.g. "Midtown Center").

Deliberate data-quality issues — baked in so the validation exercises find something.

IssueRoughly how manyHow to find it
Negative fares~4WHERE fare_amount < 0
NULL pickup zone~4WHERE pickup_location_id IS NULL
Duplicate trips2GROUP BY … HAVING COUNT(*) > 1
Orphaned pickup IDs~4LEFT JOIN nyc_taxi.raw_zones … WHERE location_id IS NULL

This is a teaching sample, not the full 57K-row dataset. Numbers differ from the chapter, but every query shape works the same.