Loading...

US Active User Share

A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
medium

Problem

The two tables share one person per row, keyed by users.user_id and customers.customer_id (same integer value, different column name). Count every users row in the denominator. In the numerator, count users rows whose account_status is 'active' AND whose matching customers row has country = 'US'. Users without a matching customers row never count toward the numerator but still count toward the denominator. Return one number: the percentage (numerator / denominator * 100).

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.