SQL Interview Questions

100%

Question 11

Which function is used to get the current date?
date()
callDate()
datetime()
getdate()




Answer is getdate()

SELECT GETDATE(); // Returns date time in format like; 2022-03-21 17:02:13.160

Question 12

What is denormalization?



Denormalization is combining tables into a one table technique which is used to access data from higher to lower forms of a database.

Increases the performance of the entire infrastructure as it introduces redundancy into a table.

Adds the redundant data into a table by incorporating database queries that combine data from various tables into a single table.

Question 13

What is a Indexing in a database?



Indexing is a way to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed. It is a data structure technique which is used to quickly locate and access the data in a database. Indexes are created using a few database columns.

A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. Indexes are used to quickly locate data without having to search every row in a database table every time a database table is accessed. Indexes can be created using one or more columns of a database table, providing the basis for both rapid random lookups and efficient access of ordered records.

Question 14

What is Normalization?



Normalization is the process of organizing data to avoid dublication and redundancy

• Efficient data access
• Reduces redundant and dublicate data
• Provides data consistency within the database
• More flexible database design and queries
• Allow easy modification
• Easy to implement and higher database security
• Better and quicker execution
• Better database organization

Question 15

What is the difference between delete table, drop table and truncate table commands?



DELETE
• Delete removes row(s) from the table and it could be rolled back
• It deletes rows one by one with conditions.
• It does not reset the table identity to its seed value if there is an identity column.
• It is a DML(Data Manipulation Language) command and it needs delete permission.

TRUNCATE
• Truncate removes all the rows from the table and it cannot be rolled back!
• It deletes all the data at once. So it is faster!
• It resets the table identity to its seed value.
• It is a DDL(Data Definition Language) command and it needs alter table permission.

DROP
• Drop removes the table from the database and it cannot be rolled back

Question 16

What is the Trigger?



Trigger in SQL is a special type of stored procedures that are defined to execute automatically in place or after data modifications. It allows you to execute a batch of code when an insert, update or any other query is executed against a specific table.

< Previous Page

Quick access to all questions in this exam