Write a SQL query joining the donation dataset with a user info dataset containing user_id and count launch/country details.
Asked in the Phone Screen stage. Table 1 donation data combined with user info dataset.
user_id.user_id with donation totals, launch count, and country count.total_donations descending, then user_id ascending.user_id, launch_country, launch_count, country_count, total_donations.total_donations as numeric(12,2), displaying exactly two decimal places.0.00 for users with no donation amounts.launch_country.| Column | Type | Description |
|---|---|---|
| donation_idPK | INT | Unique donation record identifier |
| user_id | INT | User who made the donation |
| donation_amount | NUMERIC(12,2) | Donation amount in dollars |
| donation_date | DATE | Date the donation was created |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Meta user identifier |
| launch_country | VARCHAR(2) | Country code associated with the user's launch |
| launch_count | INT | Number of launches attributed to the user |
| country_count | INT | Number of distinct countries associated with the user |