Interview practice question
Percent of total per category
Data Engineering · SQL · Beginner
Show each category's sales and its percentage of total sales.
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Aggregate sales by category first.
- Use SUM(...) OVER () to get the grand total on every row.
- Divide and multiply by 100, cast to avoid integer division.
- Round for display.
- Window avoids a separate subquery.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.