Back to Practice
#0367
Filter Key Value Settings
EasySQL15 min10 XP
Problem
Return user_id values where setting_key is "theme" and setting_value is "dark".
Why This Matters
SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.
Schema
settings(user_id INTEGER, setting_key TEXT, setting_value TEXT)
Examples
Example 1
Inputonly user 1 has theme dark
Outputuser 1
Both key and value must match.
Constraints
- Return only the requested columns.
- Use deterministic ORDER BY when multiple rows are returned.
- Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
Inputonly user 1 has theme dark
Expected[[1]]
Both key and value must match.
Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks