human
Schema:
School (School_id, School_name, Location, Mascot, Enrollment, IHSAA_Class, IHSAA_Football_Class, County)
budget (School_id, Year, Budgeted, total_budget_percent_budgeted, Invested, total_budget_percent_invested, Budget_invested_percent)
endowment (endowment_id, School_id, donator_name, amount)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the average endowment amount?
assistant
SELECT AVG ( amount ) FROM endowment;
human
What is the minimum endowment amount?
assistant
SELECT MIN( amount ) FROM endowment;
human
How many endowments are there that have an amount smaller than or equal to 10?
assistant
SELECT COUNT( * ) FROM endowment WHERE amount <= 10;
human
List all the names of schools with this kind of endowment.
assistant
SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T1.school_id HAVING SUM( T1.amount ) <= 10 ;