1
create database mbsys
default character set utf8
default collate utf8_german2_ci;
''this generates normal''
create table PESSOA (
ID_PESSOA int (10) not null,
NOME varchar (40) not null,
CPF int (11) not null,
NASCIMENTO date not null,
SEXO enum ('M','F') not null,
constraint PK_ID_PESSOA PRIMARY KEY (ID_PESSOA),
constraint UK_CPF unique (CPF)
)default charset = utf8;
''this generates normal''
create table ENDERECO (
ID_PESSOA int (10) not null,
RUA varchar (40) not null,
NUMERO varchar (10) not null,
CEP int (11) not null,
BAIRRO varchar (10) not null,
CIDADE varchar (10) not null,
constraint FK_ID_PESSOA foreign key (ID_PESSOA)
references PESSOA (ID_PESSOA)
)default charset = utf8;
''that gives the problem''
create table VENDA (
ID_PESSOA int (10) not null,
ID_VENDA int (10) not null,
VALOR_TOTAL decimal (8,2),
constraint PK_ID_VENDA PRIMARY KEY (ID_VENDA),
constraint FK_ID_PESSOA foreign key (ID_PESSOA)
references PESSOA (ID_PESSOA)
)default charset = utf8;
ERROR LOG:
> 12:05:44 create table VENDA ( ID_PESSOA int (10) not null, ID_VENDA > int (10) not null, VALOR_TOTAL decimal (8,2), constraint PK_ID_VENDA > PRIMARY KEY (ID_VENDA), constraint FK_ID_PESSOA foreign key > (ID_PESSOA) references PESSOA (ID_PESSOA) )default charset = > utf8 Error Code: 1022. Can't write; duplicate key in table > 'venda' 0.375 sec
Thank you very much did not know this particularity in the oracle it allows. Even valew
– Lord Snow
If you decided to kindly signal the answer as correct and resolved ;)
– Leonardo Bonetti
how does it I did not find the button.
– Lord Snow
@Lordsnow next to my question has a "0" and below zero has a symbol of "correct" "right" kkkk is there
– Leonardo Bonetti