Types of Keys in Sql Server:
1. Primary Key : Primary Key is applied on a column to retrieve unique data from the table.
Hence it does not allow any duplicate values or null values in column.
2. Unique key : It is same as primary key just difference is that it will allow one null value in the column.
3. Candidate key : Candidate key can be applied on the columns or on set of columns which can retrieve unique data from the table. It resembles a primary key.
4. Foreign key : It is applied on a column which points to the primary key column from the other table. i.e values in the foreign key column should be the values from the primary key column of the other table.
1. Primary Key : Primary Key is applied on a column to retrieve unique data from the table.
Hence it does not allow any duplicate values or null values in column.
2. Unique key : It is same as primary key just difference is that it will allow one null value in the column.
3. Candidate key : Candidate key can be applied on the columns or on set of columns which can retrieve unique data from the table. It resembles a primary key.
4. Foreign key : It is applied on a column which points to the primary key column from the other table. i.e values in the foreign key column should be the values from the primary key column of the other table.
No comments:
Post a Comment