How many schools have a budget?
select count(distinct t1.school_id) from budget as t1 join school as t2 on t1.school_id = t2.school_id
How about the number in year 2002 or after?
select count(distinct t1.school_id) from budget as t1 join school as t2 on t1.school_id = t2.school_id where t1.year >= 2002
Please show school name, its budgeted amount, and invested amount
select t2.school_name, t1.budgeted, t1.invested from budget as t1 join school as t2 on t1.school_id = t2.school_id where t1.year >= 2002