database design - What should I connect when creating a relationship between 2 tables? -


for example have 2 tables namely parent table , children table

parent table

parent_id

name

then have children table

children_id

name

then relationship table

relationship_id

child_id

father_id or father_name?

mother_id or mother_name?

if want create relationship between 2 tables indicates parents of children should link?

should create field named example father_id unique id of parent or father_name direct link name of father in relationship table if want name of father?

you should (and @ least in if not databases that's option anyway) use primary keys relationships.
@ least 1 side of relationship needs connected table's primary key.

however, example wrote, go single person table:

tblperson (     person_id, -- primary key     person_firstname,      person_lastname,      person_mother_id, -- self reference fk     person_father_id -- self reference fk ) 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -