commit 07742617e58cf947dbaad1fb69d809f6896b26a4 Author: bot50 Date: Thu Apr 23 14:30:24 2026 +0000 daviddoji-cs50/problems/2024/sql/dese@20260423T143024.379231471Z diff --git a/1.sql b/1.sql new file mode 100644 index 0000000..1b8a098 --- /dev/null +++ b/1.sql @@ -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"; diff --git a/10.sql b/10.sql new file mode 100644 index 0000000..e69de29 diff --git a/11.sql b/11.sql new file mode 100644 index 0000000..e69de29 diff --git a/12.sql b/12.sql new file mode 100644 index 0000000..e69de29 diff --git a/13.sql b/13.sql new file mode 100644 index 0000000..e69de29 diff --git a/2.sql b/2.sql new file mode 100644 index 0000000..7b0a4ca --- /dev/null +++ b/2.sql @@ -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)"; diff --git a/3.sql b/3.sql new file mode 100644 index 0000000..bc2d051 --- /dev/null +++ b/3.sql @@ -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"; diff --git a/4.sql b/4.sql new file mode 100644 index 0000000..c614136 --- /dev/null +++ b/4.sql @@ -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; diff --git a/5.sql b/5.sql new file mode 100644 index 0000000..86540ed --- /dev/null +++ b/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; diff --git a/6.sql b/6.sql new file mode 100644 index 0000000..ee8c6ef --- /dev/null +++ b/6.sql @@ -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" = ( + SELECT "school_id" + FROM "graduation_rates" + WHERE "graduated" = 100 + ) +; diff --git a/7.sql b/7.sql new file mode 100644 index 0000000..e69de29 diff --git a/8.sql b/8.sql new file mode 100644 index 0000000..e69de29 diff --git a/9.sql b/9.sql new file mode 100644 index 0000000..e69de29