1
Hello, good, I’m having a hard time giving insert in the table divide, being that in it I have two FK’s that link the table person.. My question is the following: How to get the desired PK’s and insert as FK’s?
Divide table:
create table divida(
codigo_divida int(5) primary key auto_increment,
credor int(5) not null,
foreign key (credor) references pessoa(id_cliente),
data_atualizacao date not null,
valor_divida float not null,
devedor int(5) not null,
foreign key (devedor) references pessoa(id_cliente)
);
Table person:
create table pessoa
(id_cliente int(5) primary key auto_increment,
nome_cliente varchar(45) not null,
tipo varchar(10) not null,
telefone varchar(20) null,
documento varchar(25) not null,
endereco int(5),
foreign key (endereco) references endereco(endereco_id),
e_mail varchar(45) null,
unique(documento, e_mail)
);
Any help will be good life, thank you all!
Thanks for the feedback, but in this case, it’s not functional! I wanted to enter any ID, not necessarily the last one.. understand? If you can give me a light thank you very much!
– M. Ribeiro