Active Users in 2025
Easy
SQLWHERE
Problem
Schema: User(id INT, name VARCHAR, last_login DATE, status VARCHAR).
Return id and name of users whose status = 'active' AND last_login >= '2025-01-01'.
Example 1
Input: Rows with status="active" and last_login in 2025
Output: Those rows' id and name
Constraints
- Status is one of
active,dormant, orclosed.
Approach — Core Patterns
This is a Core Patterns problem. The idea: pick the data structure best matched to the constraints and solve it in one clean pass. Work through the reference code below line by line, then re-derive it yourself in the editor — that's how the pattern sticks.
Complexity: see the walkthrough below.
Solution code
SQL
SELECT id, name
FROM User
WHERE status = 'active'
AND last_login >= '2025-01-01';
Practice it
Reading a solution isn't the same as being able to write it under pressure. Open this problem in the in-browser editor, hide the solution, and solve it from scratch — your code runs against real test cases instantly.
Solve Active Users in 2025 interactively → ← All solutions