Hi there,
At the moment I am learning sql and begin to encounter problems with certain triggers. This is very basic but I do not know how to solve it.
The problem is this: I have two tables Person
and BankAccountInfo
. The table Personincludes personal information. as identification number, name, birth date, etc. . The
BankAccountInfo` table contains banking information for each person in the Person table.
Person (ID number (12) primary key
, name varchar (60)
, phone number
, ...)
BankAccountInfo (ID number (12) references Person
, bankaccount number (8) primary key
, ...)
What I want is when I remove a person, the row for this person also be removed from the table BankAccountInfo, DELETE Person WHERE ID = 123456
.
The problem is that I do not know how the information goes into the trigger
CREATE
TRIGGER DELETEINFO
BEFORE DELETE ON Person
BEGIN
DELETE BankAccountInfo where ID = ?????? <- What do i put here?
END;