I am developing a system in which I have a table Employees
with multiple columns related to employees. I have a column for the JobTitle
and another column for Department
.
In my current design, the JobTitle
& the Department
columns are compound foreign keys in the Employees
table and they are linked with the Groups
table which has 2 columns compound primary key (JobTitle
& Department
) and an extra column for the job description.
I am not happy about this design because I think that linking 2 tables using 2 compound varchar
columns is not good for the performance, and I think it would be better to have an Integer
column (autonumber) JobTitleID
used as the primary key in the Groups
table and as a foreign key in the Employees
table instead of the the textual JobTitle
& the Department
columns.
But I had to do this because when I import the employees list (Excel) into my Employees
table it can just be directly mapped (JobTitle --> JobTitle & Department --> Department). Otherwise if I am using an integer index as primary key I would have then to manually rename the textual JobTitle
column in the excel sheet to a number based on the generated keys from the Groups
table in order to import.
Is it fine to keep my database design like this (textual compound primary key linked with textual compound foreign key)? If not, then if I used an integer column in the Groups
table as primary key and the same as a foreign key in the Employees
table then how can I import the employees list from excel directly to Employees
table?
Is it possible to import the list from Excel to SQL Server in a way that the textual JobTitle
from the excel sheet will be automatically translated to the corespondent JobTitleID
from the Groups
table? This would be the best solution, I can then add JobTitleID
column in the Groups
table as a primary key and as a foreign key in the Employees
table.
Thank you,