From 5e7a11eada80fec5011a5f7da33f3e06dc244ad7 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Tue, 28 Apr 2026 16:16:55 +0200 Subject: [PATCH] automated commit by check50 [check50=True] --- 9.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/9.sql b/9.sql index e69de29..a34ff07 100644 --- a/9.sql +++ b/9.sql @@ -0,0 +1,14 @@ +-- write a SQL query to find the 5 lowest paying teams (by average salary) in 2001. +-- Round the average salary column to two decimal places and call it “average salary”. +-- Sort the teams by average salary, least to greatest. +-- Your query should return a table with two columns, one for the teams’ names and one for their average salary. +SELECT + t."name", + ROUND(AVG(s."salary"), 2) AS "average salary" +FROM "teams" AS t +JOIN "salaries" AS s + ON s."team_id" = t."id" +WHERE s."year" = '2001' +GROUP BY t."id", t."name" +ORDER BY "average salary" ASC +LIMIT 5;