Booting PostgreSQL in your browser…
Schema & seed data
nyc_taxi.raw_trips — one row per taxi trip (~160 rows in this sample).
| Column | Type | Description |
|---|---|---|
vendor_id | int | Taxi company that recorded the trip (1 or 2). |
pickup_datetime | timestamp | When the meter started. |
dropoff_datetime | timestamp | When the meter stopped. |
passenger_count | int | Number of passengers (1–4). |
trip_distance | numeric | Trip length in miles. |
pickup_location_id | int | Zone where the trip started. Joins to nyc_taxi.raw_zones.location_id. |
dropoff_location_id | int | Zone where the trip ended. Joins to nyc_taxi.raw_zones.location_id. |
fare_amount | numeric | Base fare in dollars. |
tip_amount | numeric | Tip in dollars. |
payment_type | int | 1=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).
| Column | Type | Description |
|---|---|---|
location_id | int | Primary key. Referenced by both ID columns in nyc_taxi.raw_trips. |
borough | text | NYC borough the zone sits in. |
zone | text | Human-readable zone name (e.g. "Midtown Center"). |
Deliberate data-quality issues — baked in so the validation exercises find something.
| Issue | Roughly how many | How to find it |
|---|---|---|
| Negative fares | ~4 | WHERE fare_amount < 0 |
| NULL pickup zone | ~4 | WHERE pickup_location_id IS NULL |
| Duplicate trips | 2 | GROUP BY … HAVING COUNT(*) > 1 |
| Orphaned pickup IDs | ~4 | LEFT 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.