automated commit by check50 [check50=True]

This commit is contained in:
daviddoji
2026-04-27 17:41:02 +02:00
parent 7f047c1ea4
commit f657a22d38

21
13.sql
View File

@@ -0,0 +1,21 @@
-- write a SQL query to answer a question you have about the data! The query should:
--
-- Involve at least one JOIN or subquery
-- Which schools have the highest graduation rates in districts that spend less than the average per-pupil expenditure?
SELECT
s."name" AS "school",
d."name" AS "district",
e."per_pupil_expenditure",
g."graduated"
FROM "schools" AS s
JOIN "districts" AS d
ON s."district_id" = d."id"
JOIN "expenditures" AS e
ON d."id" = e."district_id"
JOIN "graduation_rates" AS g
ON s."id" = g."school_id"
WHERE e."per_pupil_expenditure" < (
SELECT AVG("per_pupil_expenditure")
FROM "expenditures"
)
ORDER BY g."graduated" DESC, s."name" ASC;