Important Difference in SQL Server:
|
Difference between Primary Key and Unique key | ||
|
Sr.No. |
Primary Key |
Unique key |
|
1 |
It cannot have null values |
It can have nulls |
|
2 |
In a table there will be only one primary key. |
In a table we can create multiple unique key. |
|
3 |
By Default, primary key creates clustered index. |
By default, It creates non-clustered index. |
|
Difference between Delete and Truncate | ||
|
Sr.No. |
Delete |
Truncate |
|
1 |
Deleted data can be rolled back. |
Truncated data cannot be rolled back. |
|
2 |
Delete is slower than Truncate. |
It is faster than delete. |
|
3 |
It can have where clause. |
It cannot have where condition. |
|
4 |
Delete operation is logged on row wise. |
It is on page wise. |
|
5 |
It does not reset the identity value. |
It resets. |
|
6 |
It is DML statement |
It is DDL statement. |
Mayur GujrathiPosted May 9, 2011, 3:59 AM
Nice and descriptive