Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialD Elis
13,571 PointsQuiz Question 1 of 5: Write a query to find out which managers have more than 5 people on their team.
Write a query to find out which managers have more than 5 people on their team. If you need to use a count, use 'COUNT(1)'.
I was having some trouble with this quiz question...
1 Answer
D Elis
13,571 PointsAfter looking through my notes I found the correct answer.. we have to use the HAVING keyword when we use GROUP BY...
SELECT MANAGERS.FIRST_NAME, MANAGERS.LAST_NAME FROM MANAGERS JOIN EMPLOYEES ON EMPLOYEES.MANAGER_ID = MANAGERS.ID GROUP BY MANAGERS.ID HAVING COUNT(1) > 5 ;
Hope this helps anyone else that was stuck here
Ikechukwu Arum
5,337 PointsYOU have to use all small letters to get it correct in the quiz
HAVING count(1) >5
D Elis
13,571 PointsD Elis
13,571 PointsSELECT MANAGERS.FIRST_NAME, MANAGERS.LAST_NAME FROM MANAGERS JOIN EMPLOYEES ON EMPLOYEES.MANAGER_ID = MANAGERS.ID GROUP BY MANAGERS.ID ___________;