Question: Use the following tables below to write query commands Table 1: Year -> columns are: *year#, yeargoal, Table 2 : Gift -> columns are: amount,
Use the following tables below to write query commands
Table 1: Year -> columns are: *year#, yeargoal, Table 2: Gift -> columns are: amount, and Table 3: Donor ->columns are: *donor#, dlname, dfname, dphone, dstate, dcity
1. List the donors who have made a donation every year. -- HINT: Inner join Donor on Gift, aggregate the count of gift.year# by donor (the number of years a donor has donated) -- and use HAVING to limit results to when this count is equal to a sub-query counting Year.year#
2. List the donors whose average donation is more than twice the average donation of all donors. -- HINT: Similar to f. above but average the gift amount for each donor -- and using HAVING to limit results to when this average is greater than a sub-query averaging all gift amounts
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
