mysql - Creating a Table in SQL, where each tuple can have mutiple values -
I am trying to create a table using the table in SQL where a person can work in many places.
Now, because a person has to make the table (person four (15), place four (15), salary int
Can work in many places, I am confused that there are many values in place of Tupal, if yes. How do I do this? Thank you in advance
You should create three separate tables:
"people" Ent ID (primary key, auto increment) varchar username varchar email ... (all other information is required) "places" int id (primary key, auto-increment increase) varchar name etc.
and the third table gives you a relationship between two:
"id =" person_places "(or place_persons, depending on what you like) int id (Primary key, auto-intent) int place_id (linked with the id of the "places" entry) int intert (id "id" is linked to)
In this way, every Once a person starts working in a new place, you simply add an entry for "person_places" in the same place when they are in place , Or some place is out of business or whatever, you have to touch the "person-space" table.
In addition, in this way, a person can work in many places, just like in a place many people can work.
Comments
Post a Comment