

create table ATM(station_code varchar(10),
constraint ATM_key primary key(station_code));

create table GonyVA(station_code varchar(10),
                    serial_number varchar(10),
                    authorisation_date date,
constraint GonyVA_key primary key(station_code),
constraint GonyVA_unique unique(serial_number),
constraint ATM_foreign_key foreign key(station_code) references ATM(station_code),
constraint Plastic_card_foreign_key foreign key(serial_number) references Plastic_card(serial_number));

create table GoaVA(station_code varchar(10),
                   serial_number varchar(10),
constraint GoaVA_key primary key(station_code),
constraint GoaVA_unique unique(serial_number),
constraint ATM_foreign_key2 foreign key(station_code) references ATM(station_code),
constraint Plastic_card_foreign_key2 foreign key(serial_number) references Plastic_card(serial_number));

create table GonyPO(station_code varchar(10),
                    serial_number varchar(10),
                    operation varchar(100),
                    operation_date date,
constraint GonyPO_key primary key(station_code,serial_number,operation),
constraint GoaVA_foreign_key foreign key(station_code) references GoaVA(station_code) on delete cascade,
constraint GoaVA_foreign_key2 foreign key(serial_number) references GoaVA(serial_number) on delete cascade);

create table GoCO(station_code varchar(10),
                  serial_number varchar(10),
                  operation varchar(100),
constraint GoCO_key primary key(station_code,serial_number,operation));

insert into ATM values('0000000001');