InterviewSolution
| 1. |
Different Types Of Keys In Sql? |
|
Answer» The different types of KEYS in sql server are: A candidate key acts as a unique key. A unique key can be a PRIMARY key. A candidate key can be a single COLUMN or combination of columns. Multiple candidate keys are allowed in a table. Primary Key:
Foreign Key: A foreign key in a table is a key which refer ANOTHER tables primary key . A primary key can be referred by multiple foreign keys from other tables. It is not required for a primary key to be the REFERENCE of any foreign keys. The interesting part is that a foreign key can refer back to the same table but to a different column. This kind of foreign key is known as self-referencing foreign key. The different types of Keys in sql server are: A candidate key acts as a unique key. A unique key can be a Primary key. A candidate key can be a single column or combination of columns. Multiple candidate keys are allowed in a table. Primary Key: Foreign Key: A foreign key in a table is a key which refer another tables primary key . A primary key can be referred by multiple foreign keys from other tables. It is not required for a primary key to be the reference of any foreign keys. The interesting part is that a foreign key can refer back to the same table but to a different column. This kind of foreign key is known as self-referencing foreign key. |
|