From event_data, return event_id and JSON_EXTRACT_SCALAR(payload, '$.currency') AS currency for even
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
Problem
From event_data, return event_id and JSON_EXTRACT_SCALAR(payload, '$.currency') AS currency for event_type = 'purchase'. Group by currency and count events per currency as events_for_currency. Exclude rows where currency IS NULL. Order by events_for_currency DESC, currency.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.