Skip to content

Instantly share code, notes, and snippets.

@sonalkr132
Created December 12, 2018 17:15
Show Gist options
  • Save sonalkr132/976223056926c70a093051c1b2e64c00 to your computer and use it in GitHub Desktop.
Save sonalkr132/976223056926c70a093051c1b2e64c00 to your computer and use it in GitHub Desktop.
select substr(name,1,1) as alpha, count(id)/30
from rubygems
group by substr(name,1,1);
alpha | ?column?
-------+----------
_ | 0
- | 0
. | 0
0 | 0
1 | 0
2 | 0
3 | 0
4 | 0
5 | 0
6 | 0
7 | 0
8 | 0
9 | 0
a | 329
A | 4
b | 214
B | 3
c | 383
C | 6
d | 230
D | 4
e | 174
E | 2
f | 231
F | 3
g | 217
G | 3
h | 174
H | 2
i | 116
I | 1
j | 141
J | 2
k | 88
K | 1
l | 174
L | 2
m | 335
M | 4
n | 118
N | 2
o | 135
O | 1
p | 264
P | 4
q | 30
Q | 0
r | 496
R | 6
s | 530
S | 8
t | 260
T | 4
u | 61
U | 1
v | 103
V | 0
w | 110
W | 1
x | 25
X | 0
y | 40
Y | 0
z | 28
Z | 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment