Platform Team Mobile 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
Vesta Innovations

Problem

Which flags in feat_flags belong to the 'platform' team and have 'mobile' somewhere in their name? A reviewer cleaning up the platform team's mobile rollouts wants each one listed next to its owner.

Mobile flags under platform ownership.

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 8 rows
ownerflag_name
platformmobile_v2
platformmobile_v2
platformmobile_v2
platformmobile_v2
platformmobile_v2

Worked solution and explanation

This is a two-condition filter dressed up as a flag cleanup, and the trap is that 'mobile' lives in this table twice. It is a fragment inside flag names like mobile_v2, and it is a whole team in owner. Anyone writes owner = 'platform'. What separates candidates is reading 'mobile in the name' as a substring test on flag_name, not flag_name = 'mobile' (zero rows) and not owner = 'mobile' (another team's flags). Drop either half and you ship 34 platform flags, or 20 mobile_v2 rows spread over three teams, instead of the 8 that answer the question.

Build it in three moves

Step 1: Pin the team with an exact match on owner

owner is a clean label: six team names, one case, no padding. So owner = 'platform' is exact, with nothing to trim or lowercase. On its own it returns every platform flag, 34 rows.

Step 2: Test flag_name for 'mobile' anywhere

Flag names are compound tokens, so the word you want is a piece of the value, never the whole value. flag_name LIKE '%mobile%' matches it wherever it sits. On its own it pulls the 20 mobile_v2 rows, owned by platform, engineering and data.

Step 3: Require both, return owner and flag_name

AND keeps only the rows that pass both tests, which leaves 8. Project the two columns the reviewer reads and stop there: no sort was asked for, and no aggregation either.

Platform-owned flags with 'mobile' in the name
SELECT owner, flag_name
FROM feat_flags
WHERE owner = 'platform'
  AND flag_name LIKE '%mobile%'
Equality on the name
flag_name = 'mobile' asks for a flag literally called mobile. None exists, so the result is empty and looks like a clean answer.
Substring on the name
flag_name LIKE '%mobile%' asks whether the word appears inside the name, which is what 'has mobile in the name' means. Combined with the owner test it returns the 8 rows.

Common follow-up questions