Daily Approval Rates
Start Timer
0:00:00
We’re given a payments table where each row is a single payment attempt. The status column is either 'approved' or 'declined'.
Write a query that returns, for each day, the approval rate and the decline rate of payment attempts. Order the results by day ascending.
Note: Group by the calendar day of timestamp. Round both rates to 4 decimal places.
Example:
Input:
payments table
| Column | Type |
|---|---|
merchant_id |
INTEGER |
transaction_id |
INTEGER |
amount |
FLOAT |
status |
VARCHAR |
timestamp |
DATETIME |
Output:
| Column | Type |
|---|---|
day |
DATE |
approval_rate |
FLOAT |
decline_rate |
FLOAT |
.
.
.
.
.
.
.
.
.
Comments