What is composite key?

Composite Key :

  • A composite key is a combination of two or more columns in a table that can be used to uniquely identify each row in the table.
  • When the columns are combined uniqueness is guaranteed but when it taken individually it does not guarantee uniqueness.
  • Sometimes more than one attributes are needed to uniquely identify an entity.
  • A primary key that is made by the combination of more than one attribute is known as a composite key.
  • Ex :
Create table abc ( c1 int , c2 varchar(20), c3 varchar(100) , PRIMARY KEY ( c1, c2 ) );

Comments

Popular posts from this blog

What are the different data types in Python?

What is __repr__ function?