1
I need the keys Process and Numero_revisao, can receive values that already exist in the table. for example:
Id = 1, Numero_Processo = 1, Numero_Revisao = 1
Id = 2, Numero_Processo = 1, Numero_Revisao = 2
Id = 2, Numero_Processo = 1, Numero_Revisao = 3
or
Id = 4, Numero_Processo = 2, Numero_Revisao = 1
Id = 2, Numero_Processo = 2, Numero_Revisao = 2
Id = 2, Numero_Processo = 2, Numero_Revisao = 3
In both cases I need to repeat the values Numero_process and Numero_revision. These fields are keys in other tables with the Quality table .
From what I understand you actually need to use a composite key (id, numero_process, numero_revise). First you need to see if you are like
identity
your current key.– Caique Romero
That one
id
also need to repeat? It is the table pk?– Costamilam
A foreign key necessarily needs to be a unique key in the reference table. You will need to choose another key from the table that is unique (
id, numero_processo, numero_revisao
, for example) and change your foreign key to this unique new record.– Rafael Araújo
My Id is unique, no need to repeat. But the fields Numero_process and Numero_revisao I need it to be key and accept repeated values. How to do?
– Danielle Arruda torres
It has to be a terrifying key, not a primary key, remove
PK_Numero_Processo
andPK_Numero_Revisao
– Rovann Linhalis
"My Id is unique, no need to repeat. But the fields Numero_process and Numero_revision I need it to be key and accept repeated values" @Daniellearrudatorres the table can only have a primary key if the field
ID
already is, you can use the other fields as foreign keys and repeat without problem– Ricardo Pontual
@Rovannlinhalis is right, it is not a primary key obliged to observe, remove the comment that was purposeless
– Ricardo Pontual