Loading...

A composite key is a combination of two or more columns in a table that is used to uniquely identify each record in table. When the columns are combined uniqueness but when it taken individually it doesn't guarantee uniqueness.
Sometime more than one columns are needed to uniquely identify the record. A primary key that is made by the combination of more than one column is known as a Composite Key / Compound Key.

In other words we can say that:
Composite Key/Compound Key which is the combination of more than one column of given table. It may be a candidate key or primary key.

The columns in composite key may have different datatypes.

Example of Composite Key
Create table Student
(
Student_ID int,
Student_Name varchar(50),
Roll_Number int,
Class int,
Constraint Comp_KeyID_Name Primary key (Roll_Number,Class)
)