SELECT & WHERE: Filter Active Users

Basics
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_idnameis_active
1Alice1
2Bob0
3Carol1

Expected Output

user_idname
1Alice
3Carol

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 BY order is checked by the grader.
  • Query type: Write a single read-only Standard SQL SELECT (or WITH ... SELECT) query.

Constraints & Evaluation Criteria

  • Return columns `user_id, name` ordered by `user_id ASC`.

Hints

SQL
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
users (3 rows)
Expected Output / Criteria
2 row(s): (1, Alice); (3, Carol)