Count Transactions
Start Timer
0:00:00
Let’s say we have an annual_payments table. Answer the following three questions via SQL queries and output them as a table with the answers to each question.
- How many total transactions are in this table?
- How many different users made transactions?
- How many transactions listed as
"paid"have an amount greater or equal to 100? - Which product made the highest revenue? (use only transactions with a
"paid"status)
Example:
Input:
annual_payments table
| Column | Type |
|---|---|
id |
INTEGER |
amount |
FLOAT |
created_at |
DATETIME |
status |
VARCHAR |
user_id |
INTEGER |
amount_refunded |
FLOAT |
product |
VARCHAR |
last_updated |
DATETIME |
Output:
| Column | Type |
|---|---|
question_id |
INTEGER |
answer |
TEXT |
.
.
.
.
.
.
.
.
.
Comments