Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with sub queries

Status
Not open for further replies.

FoxStudent

Technical User
Feb 24, 2000
85
GB
I am having a problem answering the following question:
Get the average salary of those projects that have more than seven people working on them.
The following tables make up the database:
DEPT(Dno , Dname, Location, Numstaff)
WORKS(Eno* , Pno* , Role)
EMP(Eno , Ename, Salary, Supno, Dno*)
PROJ(Pno , Pname, Ptype, Budget)

Thank you,
Grainne B-)
 
I can't really understand, what is DEPT for?

select pname, avg(b.salary) from
(
select pno, count(*) x from works group by pno having
count(*)>7
) a
inner join
(select eno, salary from EMP) b on a.eno = b.eno
inner join
PROJ on a.PNO = PROJ.pno
group by pname John Fill

ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top