Jump to content

Recommended Posts

I am doing reverse engineering to create an Entity Relation Model(Database design) for existing database.I am not able to get the right solution.

 

I have two tables:

*******

create table school(id int(8) PRIMARY KEY, name varchar(20))

Name is an index  BTREE in MYSQL table.

 

********

Then I have a name table:

 

create table name(name varchar(20));

Name is an index BTREE  here. It doesnt have any PRIMARY KEY.

 

How should I link them together?I know name from name table passes its value to school table.

 

Should I show foreign key relationshhip in ERdiagram?But in mysql datbase it is not defined.Code is defined in front end which is doing that.Can someone guide me on this ,I will appreciate that.

 

 

Link to comment
https://forums.phpfreaks.com/topic/136107-foreign-key-issue/
Share on other sites

In my opinion, yes you should mark it as a foreign key. Even if it is not defined as such in database structure, there's a front-end code taking care of it.

 

Of course there's always a risk, that data could be manipulated directly in back-end bypassing the front-end, and then the FK could be corrupted. But if all data manipulation goes through the front-end, then all should work just fine (or as fine, as fine the front-end code is :P )

Link to comment
https://forums.phpfreaks.com/topic/136107-foreign-key-issue/#findComment-709738
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.