SQLSQL
#1

Find Active Subscribers with Valid Billing in SQL

EasyAmazon
Interview Question #1
Asked at Amazon

You 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_idplan_namestatuspayment_verified_atsignup_date
101Pro Monthlyactive2026-01-152026-01-14
102Free TrialactiveNULL2026-02-01
103Pro Annualpaused2025-11-202025-11-19
104Pro Monthlyactive2026-02-102026-02-10
Expected Output Structure2 rows
user_idplan_namesignup_date
104Pro Monthly2026-02-10
101Pro Monthly2026-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.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us