SQL Server Archives - Coding Sharp

SQL Server

SQL Server Interview Question and answers

SQL Server
If you are going for an SQL Server Interview or .Net interview then you need to refer below list of questions. Below question and answer will give you a break through. Here I have prepare some simple and tricky questions for SQL Server which will really help you to go through the interview. 1. What is the difference between clustered and a non-clustered index? - Clustered index is the physical index, It reorders the records physically in the table while storing the data. - Non-Clustered index is the logical index, It does not reorders the data into table, it's just set the logical order of the index. 2. What is the difference between UNION and UNIONALL in SQL Server? - Union and Union All both are used in select statement, Union will remove the duplicate rows from the final result s...
Difference between Primary Key and Unique Key in SQL Server

Difference between Primary Key and Unique Key in SQL Server

SQL Server
In our previous article we have see the difference between Asp.Net Web Form and Asp.Net MVC, today we will see the difference between PK and UK. Difference between Primary Key and Unique Key in SQL Server Primary Key Unique Key Primary Key creates a Clustered index Unique Key creates a Non Clustered Index Primary Key does not allow null value Unique Key allows only 1 null value. A table can have only 1 Primary Key A table can have more then 1 Primary Key Primary Key is a unique key identifier of the record Unique-key is to prevent duplicate values in a column Primary Key has to be unique. Unique Key does not have to be the primary key. In Primary Key column you can't delete or change the value In Unique Key column you can delete or changes it'...