I'm trying to create a "conditional" or "just using the relational paradigm:
Since the tables pessoa
, cliente
, funcionario
and considering that a person can be a client or be an employee (a 1: 1 ratio, not null), it would be correct to reference the cliente
table and funcionario
with the same foreign key from the pessoa
table? Example:
Theforeignkeyfk_tipo
referenceFuncionario.pk_funcionario
andCliente.pk_cliente
.TheonlyproblemIencounteredinthismodeisthattheCliente
tablecannothaveaprimarykeyequaltotheotherprimarykeyoftheFuncionario
tableandviceversa.SoIwouldhavetoreviewthewaythesekeysweregenerated.
IsthereanyotherwaytoaccomplishwhatIwantbyusingtherelationalmodeltothemaximum?