Rank projects by margin within each practice
Margin is revenue - cost, and margin percentage is that margin as a share of revenue.
Within each practice area, rank projects from highest to lowest margin percentage. Two projects on the same margin percentage must share a rank, and the next project down must take the rank that skips the tie — so a tie at rank 1 is followed by rank 3, not rank 2.
Return practice, project, margin_pct rounded to 1 decimal place, and margin_rank.
Schema
| id | INT |
| practice | TEXT |
| project | TEXT |
| revenue | NUMERIC |
| cost | NUMERIC |
Basic
The example input, expected output, and walkthrough for this question unlock with a Basic plan.
Basic
The reference solution and walkthrough for this question unlock with a Basic plan.
Basic
This is a Basic question
Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.
RM 25/mo · cancel anytime