Rye
Rye

Reputation: 35

Need help designing my database

I have a given number of entities, 6 of which are related to one another. However 4 of them (Namely, JobInfo, Child, Spouse and ParentInfo) are linked to the main Person/Employee entity and this employee entity requires the primary key of the company which is CompanyID as the EmployeeID may not be unique. So I have no idea how to design my database now.

From what I know, the only way to do this is to just declare CompanyID as a foreign key in the other 4 attributes. [I'm stumped as Employee can't exist without the Company, essentially making it a weak entity and the other 4 entities cannot exist without the employee entity]

Thanks, its going to be done in mssql in sql management studio

Edit: Forgot to mention that the primary key of Employee will most likely be a composite key of the primary key of Company and Employee

Upvotes: 1

Views: 50

Answers (1)

Rye
Rye

Reputation: 35

Err I think I found an answer. I've decided to use the composite key of companyID and EmployeeID for the Employee Table (Since Employee is a weak entity) and use this composite key as a the composite primary key of the other 4 entities as all four of them will be made into weak entities as well.

Upvotes: 0

Related Questions