Different keys in SQL SERVER
Primary key: Primary key uniquely identify
a record in the table. Primary Key can't accept null values. By default, Primary key is
clustered index and data in the database table is physically organized in the
sequence of clustered index, We can have only
one Primary key in a table.
Foreign key: Foreign key is a field
in the table that is referenced to primary key in another table, Foreign key
can accept multiple null value,
Foreign key do not
automatically create an index, you can manually create an index on foreign key, We can have more
than one foreign key in a table.
Candidate key: A column, or set of columns
that can uniquely identify a row in a table.
Alternate key: Any candidate key that has
not been selected as the primary key.
Composite key: A key that is composed of
more than one column.
No comments:
Post a Comment