Sample Header Ad - 728x90

Same primary key for multiple tables vs separate primary keys

2 votes
1 answer
641 views
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? 1) A separate auto-incrementing id 2) Using employee_id of employee table
Asked by Dushyant Sabharwal (401 rep)
Jan 29, 2023, 10:15 AM
Last activity: Jul 31, 2025, 07:06 PM