This commit is contained in:
2025-11-15 09:33:22 +01:00
parent b8ac2e8a69
commit b1755eb22e
2 changed files with 47 additions and 4 deletions

View File

@@ -267,12 +267,23 @@ call add_account('EUR', array[1], array[1]);
call add_account('USD', array[1], array[1]);
call add_account('YEN', array[1], array[1]);
call add_account('EUR', array[2,3], array[0.6, 0.4]);
update account set balance = 100000 where id = 1;
update account set balance = 50000 where id = 2;
update account set balance = 2000000 where id = 3;
call add_account('EUR', array[2, 3], array[0.6, 0.4]);
call add_person('Kaneda', 'Shōtarō', '1982-12-20');
call add_account('YEN', array[5], array[1]);
create view holder_detail as
call add_company('Boucherie Sanzot', 'FR68487684235', '2014-08-14');
call add_account('EUR', array[6], array[1]);
call add_company('America Logistics', '95-4524149', '1996-09-24');
call add_account('EUR', array[7], array[1]);
call add_account('USD', array[7], array[1]);
create or replace view holder_detail as
select h.id, h.type,
case
when type = 'PERSON' then firstname || ' ' || lastname
@@ -286,14 +297,20 @@ from holder h
left join person p on p.id = h.id
left join company c on c.id = h.id;
create view account_detail as
create or replace view account_detail as
select a.balance,
a.balance * ah.share as balance_currency,
a.balance * ah.share / latest_exchange_rate(a.currency_code),
a.currency_code,
hd.nom
from account a
join account_holder ah on ah.account_id = a.id
join holder_detail hd on ah.holder_id = hd.id
join holder_detail hd on ah.holder_id = hd.id;
/************************************************************************
* Transactions
************************************************************************/
insert into transaction (amount) values (100);