Platform Team Feature Flags

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
City and County of San Francisco

Problem

Ahead of a major release, the platform team is auditing every feature flag it owns in feat_flags. Pull back all of their fields.

The platform team owns a lot of flags.

Tables

feat_flags

Columns: flag_id INTEGER, flag_name TEXT, enabled INTEGER, rollout REAL, owner TEXT, created TEXT, updated TEXT

feat_flags: 10 of 200 rows
flag_idflag_nameenabledrolloutownercreatedupdated
131new_checkout0NULLengineering2025-02-022026-02-02
162beta_search0NULLgrowth2025-03-032026-03-03
193ai_recs139platform2025-04-042026-04-04
224live_chat0NULLmobile2025-05-052026-05-05
255video_upload0NULLdata2025-06-062026-06-06
286two_factor178product2025-07-072026-07-07
317bulk_export0NULLengineering2025-08-082026-08-08
348new_dashboard0NULLgrowth2025-09-092026-09-09
379mobile_v2117platform2025-10-102026-01-10
410dark_mode0NULLmobile2025-11-112026-02-11

Expected output

First 5 of 34 rows
flag_idflag_nameenabledrolloutownercreatedupdated
193ai_recs139platform2025-04-042026-04-04
379mobile_v2117platform2025-10-102026-01-10
565video_upload195platform2025-04-162026-07-16
751new_checkout173platform2025-10-222026-04-22
937bulk_export151platform2025-04-282026-01-28

Worked solution and explanation

Two requirements hiding in one sentence

This is a row-scoping problem wearing a 'give me everything' costume. 'All fields' settles the columns; 'every flag they own' is a second, separate requirement that settles the rows, and it is the one people read past. Everyone writes SELECT *. The candidate who stops there hands back all 200 flags in feat_flags, and the platform team audits 166 flags that belong to five other teams the week before their release.

Getting there

Step 1: Settle the columns

'All fields' means every column of feat_flags, in the table's own order. SELECT * says exactly that, and here it is the honest answer: an audit wants rollout, created and updated next to the name, and a hand-typed list only gives you a chance to drop one.

Step 2: Scope the rows to the owner

'They own' points at the owner column, which holds team names. The sample rows and the preview both show the literal 'platform', so WHERE owner = 'platform' cuts 200 rows to 34. That predicate is the whole problem.

Step 3: Leave the order alone

An inventory pull is a set the team will scan, not a list read top-down. Nothing asks for an order, so there is no ORDER BY to add.

Platform-owned flags, every column
SELECT *
FROM feat_flags
WHERE owner = 'platform'
Reads only 'all fields'
SELECT * FROM feat_flags returns 200 rows from six owners. The columns are right and the audit is wrong.
Reads both requirements
Adding WHERE owner = 'platform' returns the 34 flags the team actually owns, with every column intact.

Common follow-up questions