database design - MySQL: Adding connections between people -


i have table "people" (id, name)

1, george 2, nick 3, john 4, paul 

each customer can connected customer (just reference) example george connected paul

so create new table peopleconnections (peopleconnectid, peopleid, connectedid)

and add relations between people

1, 1, 4 (george paul) 1, 2, 3 (nick john) 1, 2, 4 (nick paul) 

i need display relations inside record view gui. so

  • nick must display: john, paul
  • paul must display: george, nick
  • john must display: nick

is correct design handle this? foreign keys should add?

it's many-to-many relationship , it's correct design, in opinion. foreign keys should id people table. answered in part.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -