By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table test (
id int,
name varchar(10),
tool varchar(25)
);
insert into test values
(1,'bob','scissor'),
(2,'mike','knife'),
(3,'john','thread'),
(4,'joe','ruler'),
(5,'kim','marker'),
(6,'dean','board'),
(7,'paul','knife'),
(8,'john','scissor'),
(9,'kim','ruler'),
(10,'mike','scissor'),
(11,'mike','board'),
(12,'joe','board'),
(13,'paul','scissor'),
(13,'jake','marker');
select tool,count(tool) as nr_count
from test
group by tool
order by nr_count desc limit 5;
tool | nr_count |
---|---|
scissor | 4 |
board | 3 |
knife | 2 |
ruler | 2 |
marker | 2 |