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
| flag_id | flag_name | enabled | rollout | owner | created | updated |
|---|---|---|---|---|---|---|
| 131 | new_checkout | 0 | NULL | engineering | 2025-02-02 | 2026-02-02 |
| 162 | beta_search | 0 | NULL | growth | 2025-03-03 | 2026-03-03 |
| 193 | ai_recs | 1 | 39 | platform | 2025-04-04 | 2026-04-04 |
| 224 | live_chat | 0 | NULL | mobile | 2025-05-05 | 2026-05-05 |
| 255 | video_upload | 0 | NULL | data | 2025-06-06 | 2026-06-06 |
| 286 | two_factor | 1 | 78 | product | 2025-07-07 | 2026-07-07 |
| 317 | bulk_export | 0 | NULL | engineering | 2025-08-08 | 2026-08-08 |
| 348 | new_dashboard | 0 | NULL | growth | 2025-09-09 | 2026-09-09 |
| 379 | mobile_v2 | 1 | 17 | platform | 2025-10-10 | 2026-01-10 |
| 410 | dark_mode | 0 | NULL | mobile | 2025-11-11 | 2026-02-11 |
Expected output
| owner | flag_name |
|---|---|
| platform | mobile_v2 |
| platform | mobile_v2 |
| platform | mobile_v2 |
| platform | mobile_v2 |
| platform | mobile_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.
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
- Flag names start arriving as '`Mobile_V3`' from a new service. What changes? (Tests whether the candidate normalizes case before matching instead of trusting the current data.)
- The reviewer now wants one row per flag name with how many flags share it. How does the query change? (Tests moving from a row filter to a count at the name grain.)
- How would you keep the name test fast on a table with tens of millions of flags? (Tests knowledge of leading-wildcard cost, filtering on the indexed column first, or storing a derived platform tag.)