2 CREATE TABLE IF NOT EXISTS
person (id INTEGER PRIMARY KEY
%AUTO_INCREMENT
%AUTOINCREMENT
%,name TEXT
,surname TEXT
);
4 INSERT INTO
person (name
,surname
) VALUES
;
7 CREATE TABLE IF NOT EXISTS
money (src INTEGER
, dst INTEGER
, amount INTEGER
);
9 INSERT INTO money VALUES
;
12 SELECT
%CONCAT(name
,' ',surname
)%name
|| ' ' || surname
% AS fullname
, SUM(amount
) as total FROM person JOIN money ON src
= id GROUP BY id
;
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
;