I have a problem with a query in Oracle SQL.
I have a first_name
column in an employees
table. I want to group my records according to the
You'll need to group by everything that is not an aggregate function, so you can't have employee_id in the SELECT projection. You also need to group by just the first character of the first_name. Something like this should work:
SELECT SUBSTR(first_name, 1, 1) AS alpha, COUNT(*) AS employee_count
FROM employees
GROUP BY SUBSTR(first_name, 1, 1);
That would group by the first letter of the first name, and show the number of employees that fall into that group.