bot50
2026-04-27 15:41:48 +00:00
commit 4e0ed3cad8
13 changed files with 132 additions and 0 deletions

14
11.sql Normal file
View File

@@ -0,0 +1,14 @@
-- write a SQL query to display the names of schools, their per-pupil expenditure, and their graduation rate.
-- Sort the schools from greatest per-pupil expenditure to least.
-- If two schools have the same per-pupil expenditure, sort by school name.
--
-- You should assume a school spends the same amount per-pupil their district as a whole spends.
SELECT s."name", 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"
ORDER BY e."per_pupil_expenditure" DESC, s."name" ASC;