SQL INTERVIEW QUESTION & ANSWERS
71. |
What is the difference between Delete and Truncate command in SQL? |
|
Delete command and truncate command both will delete the data, however the truncate command can not be rolled back as delete can be. The delete command can be used for selected records using the where clause but with the truncate command we have to loose data. DELETE statement is a logged operation and hence takes more time then truncate. |
72. |
What is the difference between a table constraint and an assertion? |
|
- A table constraint is defined within a table definition and applies only to that table.
- An assertion is a type of constraint that is defined within an assertion definition (separate from the table definition).
- An assertion can be associated with one or more tables.
|
73. |
What are the different types of keys used in database management system? |
|
Different types of keys are : - Super Key
- Candidate Key
- Primary Key
- Foreign Key
|
74. |
What is a superkey? |
|
A SUPER KEY is a set of one or more attributes that allows us to identify uniquely an entity in the entity set. |
75. |
What is a PRIMARY KEY? |
|
The PRIMARY KEY is the column(s) used to uniquely identify each row of a table. A table can have only one primary key. |