Question
When NOT to use a primary key
I am planning to import an existing employee database in
Access format into a PHP/ MySQL intranet I am developing. The
Access-database is designed in a weird way, e.g how to store in
what trade each employee specializes:
Table:
EmployeeSkills(Combining tables Employee and Skill)
Coloumns:
SkillID (PK) | EmployeeID (FK) | Skill 1 | Skill 2 | Skill 3
Clearly, this database needs refurbishing, re-designing the table to contain only these coloumns:
EmployeeID (FK) | SkillID (FK)
That way I can add as many skill records to each employee as needed, and equally add just one skill witout having to display three skill inputs in the insert form/ employee detail page.
In this example, is it wise to use only the two foreign keys, or should I add an primary key to the EmployeeSkills table:
EmployeeSkillID | EmployeeID | SkillID
In general, when can I disregard the primary key in a SQL linked table design?
Best regards, Erik
Table:
EmployeeSkills(Combining tables Employee and Skill)
Coloumns:
SkillID (PK) | EmployeeID (FK) | Skill 1 | Skill 2 | Skill 3
Clearly, this database needs refurbishing, re-designing the table to contain only these coloumns:
EmployeeID (FK) | SkillID (FK)
That way I can add as many skill records to each employee as needed, and equally add just one skill witout having to display three skill inputs in the insert form/ employee detail page.
In this example, is it wise to use only the two foreign keys, or should I add an primary key to the EmployeeSkills table:
EmployeeSkillID | EmployeeID | SkillID
In general, when can I disregard the primary key in a SQL linked table design?
Best regards, Erik