From 79530d81561dfb60014a398dd40db6b841ac77f8 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Mon, 27 Apr 2026 17:31:26 +0200 Subject: [PATCH] automated commit by check50 [check50=True] --- 11.sql | 2 +- 12.sql | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/11.sql b/11.sql index a0007a7..fed4209 100644 --- a/11.sql +++ b/11.sql @@ -4,7 +4,7 @@ -- -- 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 +FROM "districts" AS d JOIN "districts" AS d ON s."district_id" = d."id" JOIN "expenditures" AS e diff --git a/12.sql b/12.sql index e69de29..6fff0ef 100644 --- a/12.sql +++ b/12.sql @@ -0,0 +1,23 @@ +-- write a SQL query to find public school districts with above-average per-pupil expenditures and +-- an above-average percentage of teachers rated “exemplary”. Your query should return the districts’ names, +-- along with their per-pupil expenditures and percentage of teachers rated exemplary. Sort the results first by +-- the percentage of teachers rated exemplary (high to low), then by the per-pupil expenditure (high to low). + +-- You might find it helpful to know that subqueries can be inserted into most any part of a SQL query, +-- including conditions. For instance, the following is valid SQL syntax: + +-- SELECT "column" FROM "table" +-- WHERE "column" > ( +-- SELECT AVG("column") +-- FROM "table" +-- ); + +SELECT d."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;