An MMORPG game is under development. For the profile and inventory mechanics, it needs a query that calculates a list of game accounts whose inventory is overloaded with game items.
The result should have the following columns: username | email | items | total_weight.
• username account username
• email-account email address
⚫items-total number of items in inventory
⚫ total weight-total weight of items in inventory
The result should be sorted in descending order by total_weight, then in ascending order by username.
Note:
• Each item in the inventory has its own weight.
• Only accounts where the total weight of all items in the inventory exceeds the overload threshold should be included in the result.
• The overload threshold is 20.
SQL query