Welcome to the SQL screen.
The question is on your right: Top Users by Recent Transaction Volume. Read through the requirements and the three tables first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
FinEdge wants a report of the most active users by recent completed transaction volume. Write a SQL query to return the top 3 users based on completed transactions in the 30-day window ending on 2024-06-30.
status = 'completed'.2024-05-31 through 2024-06-30, inclusive.card_id belongs to the same user in the cards table.user_idfull_namecountry_codetotal_volume as the sum of ABS(amount)transaction_counttotal_volume descending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Primary key for the user |
| full_name | VARCHAR(100) | User full name |
| country_code | VARCHAR(2) | ISO country code |
| signup_date | DATE | Date the user signed up |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Primary key for the transaction |
| user_id | INT | User who made the transaction |
| card_id | INT | Card used for the transaction |
| amount | DECIMAL(12,2) | Signed transaction amount |
| transaction_date | DATE | Date of the transaction |
| status | VARCHAR(20) | Transaction status |
| Column | Type | Description |
|---|---|---|
| card_idPK | INT | Primary key for the card |
| user_id | INT | Owner of the card |
| card_type | VARCHAR(20) | Type of card |
| card_status | VARCHAR(30) | Current card status |