What are the differences between primary, foreign, and unique keys?

a.       Primary Keys:

                                                              i.      Primary key uniquely identify each row in the database table.

                                                            ii.      Primary keys must contain unique value.

                                                          iii.      We can have only one primary key in a table.

                                                           iv.      Values in primary keys cannot be NULL.

b.      Foreign Keys:

                                                              i.      Foreign key is a key which points to a primary key in another table to create relation between two tables.

                                                            ii.      We can have more than one foreign key in a table.

                                                          iii.      Foreign key can accept multiple NULL values.

c.       Unique Keys:

                                                               i.      The Unique key uniquely identifies each record in a database table.

                                                            ii.      We can have more than one unique key in a table.

                                                          iii.      Unique key can accept only one NULL value

 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
1 + 8 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2019 CodingFusion
75 Important SQL Server queries you should know