bot50 committed 2026-04-27 14:14:34 +00:00
commit c78c7980fb
13 files changed
+38

No files matched your search

+2
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";
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+2
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
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
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
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;
+9
View File
@@ -0,0 +1,9 @@
-- write a SQL query to find the names of schools (public or charter!) that reported a 100% graduation rate.
SELECT "name"
FROM "schools"
WHERE "id" IN (
SELECT "school_id"
FROM "graduation_rates"
WHERE "graduated" = 100
)
;
+4
View File
@@ -0,0 +1,4 @@
-- write a SQL query to find the names of schools (public or charter!) in the Cambridge school district.
-- Keep in mind that Cambridge, the city, contains a few school districts, but DESE is interested in the
-- district whose name is “Cambridge.”
SELECT "name" FROM "districts" WHERE "city" = "Cambridge";
View File
Whitespace-only changes.
View File
Whitespace-only changes.