From 149b9da6df36bf7e203bdff6eaff36ef779e655f Mon Sep 17 00:00:00 2001 From: daviddoji Date: Mon, 27 Apr 2026 17:35:06 +0200 Subject: [PATCH] automated commit by check50 [check50=True] --- 12.sql | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/12.sql b/12.sql index 6fff0ef..432c14f 100644 --- a/12.sql +++ b/12.sql @@ -12,12 +12,22 @@ -- 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" +SELECT + d."name", + e."per_pupil_expenditure", + s."exemplary" +FROM "districts" AS d 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; +JOIN "staff_evaluations" AS s + ON d."id" = s."district_id" +WHERE d."type" = 'Public School' + AND e."per_pupil_expenditure" > ( + SELECT AVG("per_pupil_expenditure") + FROM "expenditures" + ) + AND s."exemplary" > ( + SELECT AVG("exemplary") + FROM "staff_evaluations" + ) +ORDER BY s."exemplary" DESC, e."per_pupil_expenditure" DESC;