Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Bet Latency Percentiles by Region
00:00
5 left

Bet Latency Percentiles by Region

MediumSQL · PostgreSQL

Problem

Write a query to compute percentiles of bet placement latency across different geographical regions using advanced aggregation functions.

Use the provided region and bet placement data. Ignore placements whose latency is NULL, but retain regions with no valid latency measurements.

Output

  1. One row per region, including regions without valid measurements.
  2. Columns: region_id, region_name, p50_latency_ms, p90_latency_ms, and p95_latency_ms.
  3. Sort by region_name ascending, then region_id ascending.

Schema

regions
ColumnTypeDescription
region_idPKINTUnique geographical region identifier
region_nameVARCHAR(100)Geographical region name
bet_placements
ColumnTypeDescription
placement_idPKINTUnique bet placement identifier
region_idINTRegion associated with the placement
latency_msINTBet placement latency in milliseconds
Tablesregionsbet_placements
Interviewer

Your question is Bet Latency Percentiles by Region. Start with the requirements and the two 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.