-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE TABLE survey (
    id INTEGER NOT NULL,
    name VARCHAR(50),
    openquestions INTEGER,
    PRIMARY KEY(id)
);

INSERT INTO survey VALUES(1, 'Asger', 1);
INSERT INTO survey VALUES(2, 'Benny', NULL);
INSERT INTO survey VALUES(3, 'Carlo', 3);
INSERT INTO survey VALUES(4, 'Dennis', NULL);
INSERT INTO survey VALUES(5, 'Ejgild', 2);

SELECT COUNT(*) FROM survey;
SELECT COUNT(openquestions) FROM survey;
SELECT AVG(openquestions) FROM survey;

DROP TABLE survey;
                              
