SQL
All Top 50 SQL Interview Questions#1
Find Active Subscribers with Valid Billing in SQL
EasyAmazonInterview Question #1
Asked at AmazonYou have a `subscribers` table. Write a SQL query to find all users whose account status is 'active' and who have verified their payment method (`payment_verified_at` IS NOT NULL). Return `user_id`, `plan_name`, and `signup_date` sorted by `signup_date` descending.
Input Table: subscribers
4 rows preview| user_id | plan_name | status | payment_verified_at | signup_date |
|---|---|---|---|---|
| 101 | Pro Monthly | active | 2026-01-15 | 2026-01-14 |
| 102 | Free Trial | active | NULL | 2026-02-01 |
| 103 | Pro Annual | paused | 2025-11-20 | 2025-11-19 |
| 104 | Pro Monthly | active | 2026-02-10 | 2026-02-10 |
Expected Output Structure2 rows
| user_id | plan_name | signup_date |
|---|---|---|
| 104 | Pro Monthly | 2026-02-10 |
| 101 | Pro Monthly | 2026-01-14 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
PostgreSQL 15
Ready to execute
Click "Run Query" or press Ctrl + Enter to test your query.
Output will be verified against the test dataset.