For example:
Bankaccount
, with an id
as primary key and a value.Category
, with an id
as primary key, a name and a type (boolean, 0 for positive transactions and 1 for negative)Transaction
, with an id
as primary key, a value (for example -10000$ for shopping) and a foreign key which references Category
.My question is if it's possible to add some transactions to the Transaction
table, which causes the automatic change of the value in the Bankaccount
table.
I hope someone of you could help me there!
you must use triggers: an after insert trigger Something like this (syntax depends on the used dbms):
CREATE or REPLACE TRIGGER trg_transaction
AFTER INSERT
ON ***transaction***
DECLARE
-- variable declarations
BEGIN
-- trigger code
UPDATE ***bankaccount*** SET ....
END;
Hope this will help you!!!