We can Have Multiple Primary Keys consisting of multiple columns
At 2:37 When Instructor was explaining the difference between Primary key and unique key he he said that there can be only one primary key.
I am confuse. There is a Thing called composite primary key. So there can be a possibility of a primary key consisting of multiple columns. I am confuse can you please help.
I am confuse. There is a Thing called composite primary key. So there can be a possibility of a primary key consisting of multiple columns. I am confuse can you please help.
1 answers ( 0 marked as helpful)
Hi Muaz!
Thanks for reaching out.
Composite primary keys can be useful in cases where a single column is not enough to uniquely identify each row in a table. For example, an employee have worked in different departments and have different salaries. Then we can have a composite primary key for both columns emp_no and from_date.
Hope this helps.
Best,
Tsvetelin
Thanks for reaching out.
Composite primary keys can be useful in cases where a single column is not enough to uniquely identify each row in a table. For example, an employee have worked in different departments and have different salaries. Then we can have a composite primary key for both columns emp_no and from_date.
Hope this helps.
Best,
Tsvetelin