Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Star vs Snowflake for Uber Data
00:00
5 left

Star vs Snowflake for Uber Data

MediumSQL · PostgreSQL

Problem

Explain the differences between star schema and snowflake schema; when would you choose one over the other for Uber-scale data?

Using the provided Uber trip and location tables, produce the requested aggregate as a concrete SQL example. Keep the explanation focused on dimensional modeling, query behavior, and scale-related trade-offs.

Output

  1. One row per city, with city_name, region_name, completed_trips, and gross_bookings
  2. Include completed trips requested from 2025-01-01 through 2025-01-31
  3. Sort by gross_bookings descending, then city_name ascending

Schema

trips
ColumnTypeDescription
trip_idPKINTUnique trip identifier
zone_idINTPickup zone identifier
statusVARCHAR(20)Trip lifecycle status
requested_atDATETrip request date
fare_amountNUMERIC(10,2)Trip fare before adjustments
zones
ColumnTypeDescription
zone_idPKINTUnique pickup zone identifier
zone_nameVARCHAR(80)Pickup zone name
city_idINTParent city identifier
cities
ColumnTypeDescription
city_idPKINTUnique city identifier
city_nameVARCHAR(80)City name
region_nameVARCHAR(80)Operating region name
Tablestripszonescities
Interviewer

Your question is Star vs Snowflake for Uber Data. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.