url moved
[sqlgg.git] / demo / demo.sql.pp
blob6938275ab1b384933591ba8bf453a2a9d6df74ff
1 -- @create_person
2 CREATE TABLE person (id INTEGER PRIMARY KEY %AUTO_INCREMENT%AUTOINCREMENT%,name TEXT,surname TEXT);
3 -- @add_person
4 INSERT INTO person (name,surname) VALUES;
6 -- @create_money
7 CREATE TABLE money (src INTEGER, dst INTEGER, amount INTEGER);
8 -- @add_money
9 INSERT INTO money VALUES;
11 -- @calc_total
12 SELECT %CONCAT(name,' ',surname)%name || ' ' || surname% AS fullname, SUM(amount) as total FROM person JOIN money ON src = id GROUP BY id;
13 -- @list_donors
14 SELECT DISTINCT surname FROM person JOIN money ON src = id AND dst = (SELECT id FROM person WHERE surname LIKE ?) LIMIT ?;
16 DROP TABLE IF EXISTS person;
17 DROP TABLE IF EXISTS money;