Composite Key in RDBMS


A primary key having two or more attributes is called composite key. It is a combination of two or more columns.

An example can be −

Here our composite key is OrderID and ProductID

{OrderID, ProductID}


Let us see another example −

<Student>

StudentID
StudentEnrollNo
StudentMarks
StudentPercentage
S001
0721722
570
90
S002
0721790
490
80
S003
0721766
440
86


Above, our composite keys are StudentID and StudentEnrollNo. The table has two attributes as primary key.

Therefore, the Primary Key consisting of two or more attribute is called Composite Key.

Updated on: 15-Jun-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements