Composite Key in RDBMS

RDBMSDatabaseMySQL

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.

raja
Published on 03-Jul-2018 23:21:47
Advertisements