I have a table in my database called imoveis
where I have some columns in it, highlighting localizacao_fk
and correspondencia_fk
, both foreign keys that reference the enderecos
table. What I want to know is how to insert data into the imoveis
table so that the collation of columns localizacao_fk
and correspondencia_fk
is automatically done in the enderecos
table.
An overview of what I want to do is as follows:
I have a registration form where, at some point, I have fields of two types of addresses to fill: the primary (referring to column localizacao_fk
) and secondary ( correspondencia_fk
). But in the bank, fields of this form such as zip code, street, neighborhood and city are not in the imoveis
table, but in enderecos
. Therefore, filling in such fields would populate both% w / o% and% w /% (if I want to provide this secondary address).
Help!
Here are the prints of the tables:
Realestatetable: