How many schools are there？
select count(*) from school
How many schools are there that have a total budget amount greater than 100?
select count(*) from (select count(distinct t2.school_name) from budget as t1 join school as t2 on t1.school_id = t2.school_id group by t2.school_name having sum(t1.budgeted) > 100)
How many schools are there have a total budget amount greater than 100 or a total endowment greater than 10?
select count(*) from (select t2.school_name from budget as t1 join school as t2 on t1.school_id = t2.school_id join endowment as t3 on t2.school_id = t3.school_id group by t2.school_name having sum(t1.budgeted) > 100 or sum(t3.amount) > 10)
Show the names of these schools.
select t2.school_name from budget as t1 join school as t2 on t1.school_id = t2.school_id join endowment as t3 on t2.school_id = t3.school_id group by t2.school_name having sum(t1.budgeted) > 100 or sum(t3.amount) > 10