Hello to all, if I have the following databases:
And I have the following request:IMP (Nimp, Name, Ndipart, Jobs, Director, Stip)
Departments (Ndipart, NomeDipart, City)
USO (Ndipart, Part)
Supply (Supplier, Part)
What do you think the following solution is correct?List the names and codes in the departments where the average salary of employees is <1000
In particular, I want to know:Select distinct Ndipart, NomeDipart
from Dept.
where in Ndipart
(Select distinct Ndipart
from imp
group by Ndipart
having avg (Stip)> 1000)
1) If you can put in the Select the only attribute of the group by leaving out the one used in having.
2) When in use where the Strategy "attribute in (new query)" the result of internal query should give only a single attribute comparison outer query? That is, in the Select internal must be only and only the attribute of comparison?
As always, Thanks.
Bookmarks