Questions tagged as 'foreign-key'

0
answers

MySQL is not accepting FK null

Good night, I have a request table, which has a FK client_id, this client-id, may possibly be null, but when marking that fk can be null, myslq does not accept, it marks as in null and I define a default value . What can it be?     ALTER T...
asked by 25.11.2018 / 05:38
0
answers

Create a foreign key with two varchar fields

I'm finding it very difficult to create a foreign key between two tables, whose type is varchar : ALTER TABLE netmap ADD CONSTRAINT fk_IP FOREIGN KEY ( IP ) REFERENCES ipvalidos (IPS); The error is:    Failed to execute SQL:...
asked by 06.11.2018 / 19:21
0
answers

local.ERROR: SQLSTATE [23000]: Integrity constraint violation: 1452

Expensive, Please help me with this error: local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ('clima'.'tbl_consenso', CONSTRAINT 'tbl_consenso_opcao_id_foreig...
asked by 03.09.2018 / 14:01
0
answers

Relationship of tables with error 1215

Hello, I'm trying to make a table relationship, it just gives me error ... I have my table tb_conta_fixa and my table users I want to relate the data created from tb_conta_fixa to table users ... I put this quer...
asked by 30.07.2018 / 20:01
0
answers

Relationship with LoopBack does not generate Foreign Key

I'm having a problem that is after creating the Models, and doing the autigrap / autoupdate, everything works fine for the creation of Schema in the data bank. The problem is with Foreign Key. Within it, after defining the relationship, every...
asked by 26.04.2018 / 22:56
1
answer

Can not add foreign key constraint! however syntax and pks are correct

I'm trying to create an FK for a table, I do not understand syntax error, but TOAD returns me the message that FK can not create. The tables are created in the database, and the PKs are right. ALTER TABLE minsarh.perguntas ADD CONSTRAINT fk_pe...
asked by 25.04.2018 / 18:32
0
answers

Error 1215 MySql

First of all, I would like to say that I have checked several questions about this here and no solution worked. I'm giving alter table in the official table to add two foreign keys ... one of them works (num_department) but the other one fo...
asked by 17.03.2018 / 19:25
1
answer

Problem creating foreign key in entity

I'm trying to create a primary key composite, so far so good. With this I need to do a foreign key . I have more or less the following scenario (it's a hypothetical scenario but it reflects what I need and my error): public class Keys {...
asked by 01.03.2018 / 19:25
1
answer

Error adding FOREIGN KEY to table already created [duplicate]

I have a table that needs to be changed to have a foreign key    ALTER TABLE bancocliente.producto ADD CONSTRAINT fk_fabPro FOREIGN KEY   (cod_fab) REFERENCES bancocliente.fabrica (code); I get the error message: Erro SQL (1452): Cann...
asked by 12.07.2018 / 20:50
3
answers

Doubts about database modeling, duality of ID's

I am creating a system aimed at law firm, and in the middle of development the following situation appeared: There are the following tables (summarized): TB_PROCESSO having: IDPROCESSO ID_CLIENTE ID_REU TB_CLIENTE having...
asked by 13.08.2018 / 20:23