SQL Interview Questions with Answers for Freshers - 1

Question: 1

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.

Question: 2

What is normalization?

  • Well a relational database is basically composed of tables that contain related data.
  • So the Process of organizing this data into tables is actually referred to as normalization.

Question: 3

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

Having Clause is basically used only with the GROUP BY function in a query.

WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.

Question: 4

What are the advantages and disadvantages of normalization?

There are several advantages of normalization as under:

Faster sorting and index creation.

A larger number of clustered indexes.

Narrower and more compact indexes.

Fewer indexes per table, which improves the performance of INSERT, UPDATE, and DELETE statements

Fewer null values and less opportunity for inconsistency, which increase database compactness.

Beside the above benefits there are few disadvantages as well:

Increased amount of Normalization increases the amount of complexity of joins between tables and that hinders the performance.

Question: 5

What is the use of DBCC commands?

DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.

Related Questions