Thursday, February 21, 2019

Difference between Unique Key and Primary Key.




Difference Between Primary key & Foreign key

Primary KeyForeign Key
Helps you to uniquely identify a record in the table.It is a field in the table that is the primary key of another table.
Primary Key never accept null values.A foreign key may accept multiple null values.
Primary key is a clustered index and data in the DBMS table are physically organized in the sequence of the clustered index.A foreign key cannot automatically create an index, clustered or non-clustered. However, you can manually create an index on the foreign key.
You can have the single Primary key in a table.You can have multiple foreign keys in a table.

No comments:

Post a Comment

How to use SQL pagination using LIMIT and OFFSET

  How to extract just a portion of a larger result set from a SQL SELECT. LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY. T...