I have These tables
CREATE TABLE EMPLOYEE ( EId INT, EName VARCHAR(20), Salary INT, PRIMARY KEY (EId) )
CREATE TABLE WORKS_FOR ( EId INT, PId INT, PRIMARY KEY (PId, EId) )
CREATE TABLE PROJECT ( PId INT, PName VARCHAR(20), Supervisor VARCHAR(20), Budget INT, PRIMARY KEY (PId) )
And I want to for each project, print the sum of the salaries of those employees working for that project and I want to Print also project ID and project name for each project.
I tried Using a Create View statement but I cant work out how to get sum(salary) to be for each Project.
Any ideas?
CREATE TABLE EMPLOYEE ( EId INT, EName VARCHAR(20), Salary INT, PRIMARY KEY (EId) )
CREATE TABLE WORKS_FOR ( EId INT, PId INT, PRIMARY KEY (PId, EId) )
CREATE TABLE PROJECT ( PId INT, PName VARCHAR(20), Supervisor VARCHAR(20), Budget INT, PRIMARY KEY (PId) )
And I want to for each project, print the sum of the salaries of those employees working for that project and I want to Print also project ID and project name for each project.
I tried Using a Create View statement but I cant work out how to get sum(salary) to be for each Project.
Any ideas?