Commonly asked question in an interview ?
Interviews5 answers
Can a table have more than one Primary Key ?
5 Answers
No. But you can do it by using composite primary key, which consists of multiple columns, to uniquely identify each row in a table
Kousalya PalaniPosted Jul 12, 2023, 9:52 PM EDT
no
Abhijit DasPosted Jun 21, 2023, 7:27 AM EDT
No,You cannot have two primary keys in one table.But primary can contain multiple fields.When you create table,when you mention primary key you can more then one column which you want.
like,
CREATE TABLE table_name ( col1 Datatype , col2 Datatype,col3 Datatype, col4 Datatype, PRIMARY KEY (col1,col2,col3) )
Vijay KPosted Jun 20, 2023, 1:05 PM EDT
No. Because Primary key is an identity to the row. There cannot be two identities against a row.
Kavya ChowdaryPosted May 26, 2023, 10:04 AM EDT
No, but can have more than one unique keys constraints.
TankPosted May 6, 2023, 5:03 AM EDT


