- Jul 30, 2001
- 515
- 0
- 0
I am a very new user to mySQL and I am trying to learn right now. I am reading about normalization, and Many to many relational databases. My question is this, when I have a many to many relationship between two tables, I need to create an intermediary table that links items from each table correct? In MS Access I can validate the columns such that the column X for a particular table has to be of the type "something" from another table. For example.
Users:
UserID
First Name
Last Name
Major:
MajorID
Science Major
Anyway, if I wanted to link the two I would need to create another table:
Link:
User ID
Major ID
and I was wondering if there was a way, when I am defining the "Link" table such that the column "User ID" has to be of the type specified in the "Users" table - basically like validation in MS Excel.
Also I was wondering if mySQL creates primary key ID #s automatically or if I have to do that MajorID and UserID stuff myself, and if not, how would you guys suggest doing that?
Users:
UserID
First Name
Last Name
Major:
MajorID
Science Major
Anyway, if I wanted to link the two I would need to create another table:
Link:
User ID
Major ID
and I was wondering if there was a way, when I am defining the "Link" table such that the column "User ID" has to be of the type specified in the "Users" table - basically like validation in MS Excel.
Also I was wondering if mySQL creates primary key ID #s automatically or if I have to do that MajorID and UserID stuff myself, and if not, how would you guys suggest doing that?