Lets assume we have an employee table as below
employee
id (PK) | name | date_of_birth | age | created_at
We have a scenario where we need to add some metadata for each employee and not every employee will have this metadata, so we create a new table as below
employee_metadata
id (PK) | employee_id (PK) | ... | created_at
There is a 1-1 mapping between both the tables
What would be a better design practice for the primary key of employee_metadata
table, 1 or 2?
A separate auto-incrementing id
Using
employee_id
ofemployee
table