Search code examples
sql-serverdatabase-designnormalizationrdbmserd

Entity relation


Is the following entity relation correct? I am trying to link employee, timesheet and approver table.

There are few other tables and fields but for this question my main concern is following three tables. One employee can have more than timesheet approver.

Employee
--------
EmpID pk
Name
TimeSheet
------------
TSHEET_ID PK
FK_EmpID FK
Approved_By
Timesheet_Approver (one employee can have more than one approver
                    but only one will be approving the timesheet)
------------------
EmpID
Approver_EmpID 

Employee Table Data:

EmpID Name
----- -----
1     john
2     david
3     mark

Timesheet Approver Data:

EmpID Approver
----- --------
1     2
1     3
2     3

Timesheet

TSID EMPID APPROVED_BY
---- ----- -----------
101  1     2
102  1     3
103  2     3



OR this looks okay?

enter image description here


Solution

  • My Suggestion

    Why do you want Approver as a seperate table? Can you keep a Bit Field like IsApprover in Employee table? Otherwise you are creating redundancy