SQL exercise · about 5 minutes · free
Above-Average Killers (Subquery)
Is this player suspicious, or just good? Compare each one with the average of everyone.
A subquery is a query inside another query. Here it calculates a number, the average, that the outer query compares against.
... HAVING SUM(kills) > (SELECT AVG(t) FROM (SELECT SUM(kills) AS t FROM matches GROUP BY player_id))
Your quest: Show each
name and total_kills for players whose total kills are above the average player's total.Starter code
-- outer query + subquery -- Run this first to see the players table, then change it to answer the task. SELECT * FROM players LIMIT 5;