Skip to main content

foreign key (`cod_Cbs`) references tb_cbs(cod_Cbs)

  • January 18, 2020
  • 1 reply
  • 8 views

Luis O

Good morning

I have the paid version but I am having problems with the Mysql code generation (which is the one that interests me) as a result I want the FK to relate to my tables under the keyword "reference" this allows me not to You can enter values ​​that are not in the other table in your KEY.

Example I look for this:

CREATE TABLE `TB_CBS` (
`cod_Cbs` int NOT NULL AUTO_INCREMENT
`name` varchar(50)
`description` varchar(500)
`image` varchar(150)
PRIMARY KEY (`cod_Cbs`)
);

CREATE TABLE `TB_Bonuses_Cbs` (
`cod_Bonuses_Cbs` int NOT NULL AUTO_INCREMENT
`name` varchar(50)
`description` varchar(500)
`cod_Cbs` INT
PRIMARY KEY (`cod_Bonuses_Cbs`)
foreign key (`cod_Cbs`) references tb_cbs(cod_Cbs)
);

However what I get is this:

CREATE TABLE `TB_CBS` (
`cod_Cbs` int NOT NULL AUTO_INCREMENT
`name` varchar(50)
`description` varchar(50)
`image` varchar(50)
PRIMARY KEY (`cod_Cbs`)
);

CREATE TABLE `TB_Bonuses_Cbs` (
`cod_Bonuses_Cbs` int NOT NULL AUTO_INCREMENT
`name` varchar(50)
`description` varchar(50)
`cod_Bonuses_Cbs` int
PRIMARY KEY (`cod_Bonuses_Cbs`)
KEY `FK` (`cod_Bonuses_Cbs`)
);

I have searched for similar things and they say that in Lucidchart it is not possible to add "references". Can someone help me??

Comments

  • January 24, 2020

Hi Luis

Thanks for posting in the Lucidchart Community. Unfortunately what you're describing is not directly supported by our ERD feature. I apologize for any inconvenience. If this is a functionality you'd like to see added to Lucidchart in the future please submit a feature request form. Ideas and feedback submitted to this form is passed directly to our product development team for consideration.