-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE TABLE person (navn VARCHAR(20), alder INTEGER, PRIMARY KEY(navn));

INSERT INTO person VALUES ('ib', 5);
INSERT INTO person VALUES ('bo', 3);
INSERT INTO person VALUES ('ole', 23);

SELECT FLOOR((alder-1)/10)*10+1,FLOOR(alder/10+1)*10,COUNT(*)
FROM person
GROUP BY FLOOR((alder-1)/10)*10+1,FLOOR(alder/10+1)*10;

DROP TABLE person;
