Saturday, July 19, 2014

What's the difference between a primary key and a unique key?

Primary key and Unique key enforces uniqueness of the column on which they are defined.The difference between primary key and unique are  below.

  1. Primary Key can't accept null values but where as unique key can accept null value.
  2. By default, Primary key is clustered index but By default, Unique key is a unique non-clustered index.
  3. We can have only one Primary key in a table where as we can have more than one unique key in table.

Related Posts:

  • What are the various ways of authentication techniques in ASP.NET? Selecting an authentication provider is as simple as making an entry in the web.config file for the application. You can use one of these entries to select the corresponding built in authentication provider: √ <authentica… Read More
  • What’s difference between Datagrid, Datalist and repeater A Datagrid, Datalist and Repeater are all ASP.NET data Web controls. They have many things in common like DataSource Property, DataBind Method ItemDataBound and ItemCreated. When you assign the DataSource Property of a Datag… Read More
  • Interview Questions on SQL are based on following two tables, Employee Table and Employee Incentive Table. Table Name : Employee EMPLOYEE_IDFIRST_NAMELAST_NAMESALARYJOINING_DATEDEPARTMENT 1JohnAbraham100000001-JAN-13 12.0… Read More
  • What is the Difference between Abstraction and Encspsulation Abstraction is showing only necessary things, but Encapsulation is hiding complexity. for example, if we have a user log in form then we need only user id and password and a function to put on login button this shows abstrac… Read More
  • How does authorization work in ASP.NET? ASP.NET impersonation is controlled by entries in the applications web.config file. The default setting is “no impersonation”. You can explicitly specify that ASP.NET shouldn’t use impersonation by including the following co… Read More

0 comments:

Post a Comment