SteppingHat SteppingHat - 7 months ago 13
SQL Question

SQL - Find names and total budget associated with name

I have a table named

PROJECT
that looks something like this

SQL> SELECT * FROM PROJECT;

P# PTITLE SPONSOR D# BUDGET
------ ----------------- ----------------------- ---- ----------
1001 Computation Microsoft 1 25000
1002 Study methods Education committee 3 15000
1003 Racing car Cloud Pty Ltd 3 225000
1004 Football Football club 5 35000
1005 Swimming Education committee 5 125000


And from this table, I would like to list the name of sponsors, and the total budget that each sponsor provided.

I am working with Oracle SQL and am having some difficulty with the syntax to select the data from this table.

Thanks in advance!

Answer

Simple aggregation should suffice

SELECT SPONSOR,SUM(BUDGET) 
FROM PROJECT 
GROUP BY SPONSOR
Comments