Solve an SQL query, then rewrite the same query using advanced SQL functions (window functions were expected). Asked in the Technical HR stage. Candidate's simple-function solution was accepted as a first step; interviewer wanted window functions.
category, total_amount, and amount_rank.amount_rank, then category ascending, with NULL categories last.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| category | VARCHAR(50) | Transaction category |
| transaction_date | DATE | Date of the transaction |
| amount | DECIMAL(12,2) | Transaction amount |