SQL Question. Complete rookie question but still need answer?

miks

New member
Jan 15, 2009
2
0
1
hello I am a newb in sql and working my baby steps trough it doin quite well except this one question am struggling with. Can anyone here shed some light in my matter please :)
I have provided syntax as far as I got myself. I have 2 tables there too they need to be merged. Not too worried about the sort as that is not whats stopping me here

Suppose you need to know the employee name and department name of all employees that work in a department that has at least 3 employees.
Write a SQL query to retrieve this information. Order the list in alphabetical order first by department name, then by employee name.

SELECT NAME,DEPTNAME
FROM EMPLOYEE,DEPT
WHERE COUNT(DEPTNAME) >2
AND EMPLOYEE.DEPTNO=DEPT.DEPTNO;
 
Your COUNT(DEPTNAME) thing wont work without a GROUP BY. Long story short, this is probably not what you're after. Is there a data field on the DEPT table called something like Number of staff or Number of employees? It seems like there should be.

Once you change this, your query should work.
 
Back
Top