SQLSQL
#37

Calculate User Confirmation Rate in SQL

MediumGoogle
Interview Question #37
Asked at Google

Given `signups` (user_id) and `confirmations` (user_id, action where action is 'confirmed' or 'timeout'), find the confirmation rate of each user rounded to 2 decimal places. Users who did not request any confirmation messages should have a confirmation rate of 0.00.

Input Table: signups & confirmations
4 rows preview
user_idaction
3timeout
3confirmed
7confirmed
2NULL
Expected Output Structure3 rows
user_idconfirmation_rate
20
30.5
71
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