+ 1

Composite primary key

Is it practical to have a composite primary key in a database table ?

30th Jul 2019, 1:56 AM
Sanjay Kamath
Sanjay Kamath - avatar
1 Answer
+ 2
You can choose a composite key for a table as primary key Like in a student table even name of student can uniquely identity student ( here name is composition of first middle and last name) But in larger tables composite primary key should be avoided. In the same table there will be a 'student_Id' which is always unique. So it'll be chosen as primary key rather than 'name'. In brief a primary key should be unique , not null, non repeated and it should not be composite one if there is a better primary key in same table.
31st Jul 2019, 12:41 AM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar