-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE TABLE jsum (
    id INTEGER NOT NULL,
    jv JSON,
    PRIMARY KEY(id)
);
INSERT INTO jsum VALUES(1, '{"f":123}');
INSERT INTO jsum VALUES(2, '{"f":456}');
SELECT SUM(jv->>'$.f') FROM jsum;
DROP TABLE jsum;
