#195

MMORPG Game Inventory Overload Notification

MEDIUMAggregation & JoinsPOSTGRESQL

Problem Description

You are working on a gaming analytics pipeline that monitors player behavior in a massively multiplayer online role-playing game (MMORPG). The platform tracks every item a player carries and its weight, and the game engine triggers overload notifications when a player's total carried weight exceeds the account's weight limit. Your task is to identify all accounts whose inventory is overloaded so the notification service can dispatch alerts. **Overload Rule:** An account is overloaded when the sum of the weights of all items it currently carries exceeds the threshold of **20**. Each row in `accounts_items` represents one carried item — so an account carrying the same item multiple times has that item’s weight counted once per row. Accounts whose total weight equals exactly 20 are **not** overloaded. Return `username`, `email`, the total count of carried items as `items`, and the `total_weight` of all carried items. Order results by `total_weight` descending, then by `username` ascending.

Topics

groupingaggregation

Asked at Companies

spur

Solve This Problem

Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.

Start Solving →