BasicsSELECTWHEREGoogleAmazonMeta
Table
users(user_id INT, name VARCHAR, is_active INT)
Task
From table users(user_id, name, is_active), return user_id and name for all active users (is_active = 1), ordered by user_id ASC.
Why It Matters: Filtering active records with SELECT ... WHERE is the foundational query behind every DAU/MAU dashboard and churn cohort.
Output columns: user_id, name
Example
Input — users
| user_id | name | is_active |
|---|---|---|
| 1 | Alice | 1 |
| 2 | Bob | 0 |
| 3 | Carol | 1 |
Expected Output
| user_id | name |
|---|---|
| 1 | Alice |
| 3 | Carol |
Explanation: Only rows with is_active = 1 (Alice and Carol) pass the WHERE filter and are returned ordered by user_id ASC.
Requirements
- Exact output columns:
user_id,name - Row order: Exact
ORDER BYorder is checked by the grader. - Query type: Write a single read-only Standard SQL
SELECT(orWITH ... SELECT) query.
Constraints & Evaluation Criteria
- Return columns `user_id, name` ordered by `user_id ASC`.
Hints
SQL⌘/Ctrl+Enter to Run · ⌘/Ctrl+Shift+Enter to Submit
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
users (3 rows)
Expected Output / Criteria
2 row(s): (1, Alice); (3, Carol)