Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Emp_Code
OnDate
Attended
NotAttended
Total_Hours
Total_Minutes
Total_Seconds
Shift_Start_Time
Shift_End_Time

Emp_Code is the foreign key

Does this employee need foreign key??
the table would be updated daily.
If it needs primary key than what would be and if it doesnt need than why.

[Edit]: Shouting removed
Posted
Updated 21-Feb-14 3:42am
v2

Primary key are fields (single or multple) where their combination of values are unique in the table, i.e. no 2 records should have the same combination of values in these primary key fields.
Which fields where the combination of values in your table cannot be repeated, ask yourself this question, and you should be able to get the answer.
P.S. Do not use all-capital, it will draw flak instead of attention.
 
Share this answer
 
v2
1)You should add as primary key a new filed named "ID" for example, of type integer and with autoincrement.

2)foreign key should remain because is the link with data that come from other table (employee data);
 
Share this answer
 
For each employee if only one new record is added on each day in your table, then you can set Emp_Code & OnDate as Composite key to filter out duplicate records.

Emp_Code will act as Foreign Key as you said.
 
Share this answer
 
v3
Every table must have a Primary_key ,having a primary key (which by default also is the clustering key) can actually speed up many operations on SQL Server tables
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900