Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
histogram to percentiles
CREATE TABLE ranks AS SELECT make, model, rank1_cnt, rank2_cnt, rank3_cnt FROM ( VALUES ( 'samsung' , 's6', 1 , 4 , 2 ), ( 'samsung' , 's7' , 3 , 2 , 1), ( 'lg' , 'g7', 1 , 1 , 3) ) AS t(make, model, rank1_cnt, rank2_cnt, rank3_cnt); SELECT make, model, percentile_disc(0.5) WITHIN GROUP (ORDER BY gs1.x) FROM ( SELECT make, model, ARRAY[rank1_cnt, rank2_cnt, rank3_cnt] FROM ranks ) AS t(make, model, ranks) CROSS JOIN LATERAL generate_series(1,3) AS gs1(x) CROSS JOIN LATERAL generate_series(1,ranks[gs1.x]) AS gs2(x) GROUP BY make, model ORDER BY make;
run
|
edit
|
history
|
help
0
Dashes in numbers
revenue average per current month, last 3, 6 and 12 months
75 95
SQL social network practice by Han Wang 20200720 - 2
lol
E2
hell
G.Giftcard Interview Analysis Conducted by Miranda Zhao
loggin_trigger-audit
1127. User Purchase Platform