automated commit by check50 [check50=True]
This commit is contained in:
2
4.sql
2
4.sql
@@ -2,7 +2,7 @@
|
||||
-- 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("name") AS "Number of schools"
|
||||
SELECT "city", COUNT(*) AS "Number of schools"
|
||||
FROM "schools"
|
||||
WHERE "type" = "Public School"
|
||||
GROUP BY "city"
|
||||
|
||||
9
5.sql
9
5.sql
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user