Using LEFT JOIN of users to transactions, return user_id and COALESCE(COUNT(t.transaction_id), 0) AS
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
Problem
Using LEFT JOIN of users to transactions, return user_id and COALESCE(COUNT(t.transaction_id), 0) AS tx_count (users with no transactions get 0). Group by user_id. Order by tx_count ASC, user_id.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.