bot50
2026-04-23 14:21:11 +00:00
commit 144a39e272
13 changed files with 25 additions and 0 deletions

2
1.sql Normal file
View File

@@ -0,0 +1,2 @@
-- write a SQL query to find the names and cities of all public schools in Massachusetts.
SELECT "name", "city" FROM "schools" WHERE "type" = "Public School";

0
10.sql Normal file
View File

0
11.sql Normal file
View File

0
12.sql Normal file
View File

0
13.sql Normal file
View File

2
2.sql Normal file
View File

@@ -0,0 +1,2 @@
-- write a SQL query to find the names of districts that are no longer operational.
SELECT "name" FROM "districts" WHERE "name" LIKE "%(non-op)";

2
3.sql Normal file
View File

@@ -0,0 +1,2 @@
-- write a SQL query to find the average per-pupil expenditure. Name the column “Average District Per-Pupil Expenditure”.
SELECT AVG("per_pupil_expenditure") AS "Average District Per-Pupil Expenditure" FROM "expenditures";

10
4.sql Normal file
View File

@@ -0,0 +1,10 @@
-- write a SQL query to find the 10 cities with the most 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"
ORDER BY "Number of schools" DESC, "city" ASC
LIMIT 10;

9
5.sql Normal file
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;

0
6.sql Normal file
View File

0
7.sql Normal file
View File

0
8.sql Normal file
View File

0
9.sql Normal file
View File