1
Utilise Mysql Workbench and I have to represent a DER in the physical model. I come across a specialization:
TABELA_PESSOA
cpf*
nome
sexo
TABELA_CLIENTE
cpf_pessoa*
email
senha
TABELA_FUNCIONARIO
cpf_pessoa*
salario
cargo
How can I make cpf_pessoa
is a foreign key (in both tables) referring to TABELA_PESSOA
and at the same time be primary keys in their respective tables?
The same way you would to declare a foreign key in another column
– Jefferson Quesado
Turns out I’ve already tried that. I opened Mysql Workbench and made a very quick script to demonstrate my problem (obviously some attribute types do not reflect reality, it was just to demonstrate): -Inicio create database test; use test; create table person( Cpf bigint Primary key, name varchar(40), sex varchar(10) ); create table client( cpf_person bigint Primary key, email varchar(40), password varchar(20), Foreign key (cpf_person) Person(Cpf) referrals); desc client; -End When I execute the "desc client", the attribute "cpf_person" appears only as primary key
– Ian D