Timeout Status Records

An easy SQL interview practice problem on DataDriven. Write the query and run it against a real database, with instant feedback.

Domain
SQL
Difficulty
easy
Seniority
L3
Asked in
Yelp

Problem

During an incident investigation, you suspect some service health records have a timeout status. Find all rows with that status value and return all available fields for each matching row.

Unknown status in the health records.

Tables

svc_health

Columns: check_id INTEGER, svc_name TEXT, status TEXT, latency REAL, uptime REAL, checked TEXT, region TEXT

svc_health: 10 of 200 rows
check_idsvc_namestatuslatencyuptimecheckedregion
137payment-apidegraded3.697.032026-02-02 01:05:00us-west-2
174user-svcunhealthy6.794.062026-03-03 02:10:00eu-west-1
211search-apitimeout9.891.092026-04-04 03:15:00ap-south-1
248gatewayHealthy12.998.122026-05-05 04:20:00eu-central-1
285notif-svcDEGRADED1695.152026-06-06 05:25:00us-east-1
322ml-servinghealthy19.192.182026-07-07 06:30:00us-west-2
359cache-svcdegradedNULL99.212026-08-08 07:35:00eu-west-1
396queue-workerunhealthy25.396.242026-09-09 08:40:00ap-south-1
433cron-svctimeout28.493.272026-01-10 09:45:00eu-central-1
470auth-svcHealthy31.590.32026-02-11 10:50:00us-east-1

Expected output

First 5 of 31 rows
check_idsvc_namestatuslatencyuptimecheckedregion
211search-apitimeout9.891.092026-04-04 03:15:00ap-south-1
433cron-svctimeout28.493.272026-01-10 09:45:00eu-central-1
655notif-svctimeout4795.452026-07-16 15:15:00us-east-1
877payment-apitimeoutNULL97.632026-04-22 21:45:00us-west-2
1099cache-svctimeout84.299.812026-01-28 03:15:00eu-west-1

Worked solution and explanation

What this is really asking

This is a single exact-value filter dressed up as an incident hunt. svc_health holds 200 health checks, and 31 of them carry the status 'timeout'. Everything else is 'healthy', 'degraded', 'unhealthy' or one of their capitalized cousins. Anyone can type SELECT *. What separates candidates is pinning the predicate to the exact value instead of returning the table or reaching for a fuzzy match. Forget the filter and the investigator gets all 200 checks, with the 31 failing probes buried among the healthy ones.

Step 1: Read the value off the sample rows

The sample rows show 'timeout' in lowercase next to 'Healthy' and 'DEGRADED' drifting in case. That drift is a reason to ask, not to normalize blindly. Timeout is always logged in lowercase here, so the literal you filter on is exactly 'timeout'.

Step 2: Filter on the literal

WHERE status = 'timeout' keeps exactly the 31 failing checks. An equality on a four-value column says precisely what the question asks and nothing more.

Step 3: Return every column untouched

The question wants every field, so SELECT * matches the ask. The preview shows all seven columns of svc_health, including the empty latency on check 877, so nothing is dropped, renamed or defaulted.

The solution

EXACT-MATCH FILTER
SELECT *
FROM svc_health
WHERE status = 'timeout'

Common follow-up questions

Common follow-up questions