Atul Singh
Atul Singh

Reputation: 21

Count names in alphabetical order in a table

I need to count names of employees in alphabetical order from employees table in HR schema (oracle)

Example..

Last_name with.     Count
A.                  4
B.                  3
...
...
Z.                  5

How the query will look like..

Upvotes: 0

Views: 147

Answers (1)

Red Devil
Red Devil

Reputation: 2393

I think this will do:

select SUBSTR(name,1,1) as name,count(1) as CNT from YOURTABLE

group by SUBSTR(name,1,1)

order by name

Upvotes: 1

Related Questions