clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2805502 fiddles created (40742 in the last week).

CREATE TABLE my_scores (date date, score int); INSERT INTO my_scores (date, score) VALUES ('2018-12-01', 2), ('2018-12-01', 4), ('2018-12-01', 5), ('2018-12-02', 3);
4 rows affected
 hidden batch(es)


SELECT date, count(*) FILTER (WHERE score < 3) AS "low0-2", count(*) FILTER (WHERE score > 2 AND score < 5) AS "high3-4", count(*) FILTER (WHERE score > 4) AS "perfect" FROM my_scores GROUP BY 1 ORDER BY 1;
date low0-2 high3-4 perfect
2018-12-01 1 1 1
2018-12-02 0 1 0
 hidden batch(es)