Solutions

1. Donations

  • What is the average total amount (in $) of donations made to each project? If two donations that amount to $10 and $20 respectively were made to project A, the total donation to project A is $30.

SELECT AVG(sums)
FROM (SELECT SUM(total_amount) as sums
	FROM donations
    GROUP BY project_id) x ;
  • How many did unique projects receive a donation at least once according to donations table?

SELECT COUNT(DISTINCT project_id)
FROM donations;
  • Some donations 'complete' projects, meaning that those last donations made to projects enabled the projects to achieve the monetary goal they set up front. Whether a donation completes a project is recorded in the column completion. Are donations that complete projects substantially larger/smaller than other donations?

SELECT AVG(total_amount)
FROM donations
WHERE completion = 1;
SELECT AVG(total_amount)
FROM donations
WHERE completion = 0
AND funded = 1;

2. Donors

  • Count the numbers of donors from each state.

SELECT state, COUNT(1) as num
FROM donors
GROUP BY state;
  • Does average amount of donation (avg_total) differ between one-time donor (num_projeccts=1) v. more-than-once donor (num_projects>1)?

SELECT avg(avg_total)
FROM donors
WHERE num_projects = 1;
SELECT avg(avg_total)
FROM donors
WHERE num_projects > 1;

Last updated

Was this helpful?