automated commit by check50 [check50=True]

This commit is contained in:
daviddoji
2026-04-23 16:21:07 +02:00
parent 1d56d1e226
commit 8c90a45a17
2 changed files with 10 additions and 1 deletions

2
4.sql
View File

@@ -2,7 +2,7 @@
-- Your query should return the names of the cities and the number of public schools within them, -- Your query should return the names of the cities and the number of public schools within them,
-- ordered from greatest number of public schools to least. If two cities have the same number of public schools, -- ordered from greatest number of public schools to least. If two cities have the same number of public schools,
-- order them alphabetically. -- order them alphabetically.
SELECT "city", COUNT("name") AS "Number of schools" SELECT "city", COUNT(*) AS "Number of schools"
FROM "schools" FROM "schools"
WHERE "type" = "Public School" WHERE "type" = "Public School"
GROUP BY "city" GROUP BY "city"

9
5.sql
View File

@@ -0,0 +1,9 @@
-- write a SQL query to find cities with 3 or fewer public schools. Your query should return the names of the cities
-- and the number of public schools within them, ordered from greatest number of public schools to least.
-- If two cities have the same number of public schools, order them alphabetically.
SELECT "city", COUNT(*) AS "Number of schools"
FROM "schools"
WHERE "type" = "Public School"
GROUP BY "city"
HAVING COUNT(*) <= 3
ORDER BY "Number of schools" DESC, "city" ASC;