olu adesina22,462 Points
sql help do i need to use the group by key word
Write a query to figure out how many employees are in each job role.
SELECT JOBS.ROLE, COUNT(1) FROM EMPLOYEES JOIN JOBS ON EMPLOYEES.JOB_ID = JOBS.ID ;
Billy Bellchambers21,689 Points
Group by is used as the name suggests to group values by a specific column value.
In this example it wants to do a count of the number of records against each value of Jobs.Role
To achieve this you can do the following.
SELECT JOBS.ROLE, COUNT(1) FROM EMPLOYEES JOIN JOBS ON EMPLOYEES.JOB_ID = JOBS.ID GROUP BY JOBS.ROLE;
Should you want some further detail on the GROUP BY statement. https://www.w3schools.com/sql/sql_groupby.asp