`-gen none` for no output
[sqlgg.git] / demo / demo.sql.pp
blobd7513cacd45e86e94796c1824c44c57261f712e2
1 -- @create_person
2 CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS 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;