From 8d861d20dfecb83f9908283c6a2ba1c63fe5d970 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Tue, 28 Apr 2026 15:45:13 +0200 Subject: [PATCH] automated commit by check50 [check50=True] --- 6.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/6.sql b/6.sql index 1f42545..8b87f93 100644 --- a/6.sql +++ b/6.sql @@ -2,10 +2,13 @@ -- Call the column representing total hits by players in 2001 “total hits”. -- Sort by total hits, highest to lowest. -- Your query should return two columns, one for the teams’ names and one for their total hits in 2001. -SELECT t."name", perf."H" AS "total hits" +SELECT + t."name", + SUM(perf."H") AS "total hits" FROM "teams" AS t JOIN "performances" AS perf ON perf."team_id" = t."id" -WHERE perf."year" = "2001" +WHERE perf."year" = '2001' +GROUP BY t."id", t."name" ORDER BY "total hits" DESC LIMIT 5;