Thursday, October 13, 2022

Top 30 Database Interview Questions and Answers

 Hello guys, if you are preparing for programming or technical interview then you must prepare for Database and SQL, these two are the most important skill for any programming or software development job be it a Java developer, C++ developer or a web developer. Earlier, I have shared 15 SQL Query Interview Questions and in this article, I am going to share 30 common database interview questions. I am not sharing the answer though as I expect you to already know the answers of these basic Database questions but if you struggle with any questions, ping me on comments section and I might just add the answers as well, depending upon what you guys like. 


30 Database Interview Questions for Programmers and DBA

Here is my list of 30 common Database related questions from technical interviews. These questions are quite common on both beginner and intermediate level of Software developer interview and a few questions like why you should not created indexes for every column in table?  was even asked to experience developers with 5 to 7 years of experience. 


1) What is Database? What is Oracle, PostgreSQL, or MSQL?
Yes, they all are database, particularly relational database. 

2) What is a Relational Database? What is NoSQL? Is it also a database?
yes, NoSQL are also database but they don't follow relational model but they store data. 

3) What is Normalization? Why it is important?
It is important to reduce duplication of data in tables. 

4) When do you Say a particular table is in 1st, 2nd, or 3rd normal form?

5) What is Boyce Code normal form or BCNF?

6) What is Referential Integrity in the database?

7) What are different Database Isolation levels?

8) Which Database you worked? What was the version?

9) What is ACID properties of a database transaction?
ACID stands for Atomicity, Consistency, Isolation and Durability. Atomicity guaranteed that operation either complete or not complete, its never half complete or half pending. Consistency means data is consistent before and after operation, Isolation means two transaction are not interfering with others, and Durability means data is not lost once written. 

Top 30 Database Interview Questions and Answers




10) How do you rollback a transaction in SQL Server?

11) What are database indexes? How does it affect query performance?

12) Why not you create index for every column in table?

13) How do you create a table by copying data from another table?

14) What is the fastest way to empty a database?

15) How do you change the name of a column in a table?

16) How do you convert a NUMERIC column to FLOAT in SQL Server?

17) What is an IDENTITY column in a database?

18) What is database statistics?

19) What is temp table in database?

20) Name five different data types from your favorite database? e.g. Oracle, Or SQL Server?

21) What is a key? A candidate key? A primary key? An alternate key? A foreign key?
A key is nothing but a column with unique identifier to find a row in a table. Primary key is the most important which can uniquely identify a record in a table. Alternate keys are other keys which can be used in place of primary key.

For example in Employee table, you can use EmployeID as primary key and EmployeName as alternate key. Foreign key is the primary key in related table. For example EMP_ID is primary key in EMP table but it can be a foreign key in DEPT table. 




22) What are the data types available and when to use which ones?

23) What is stored procedure in database?

24) What is difference between implicit and explicit curser?

25) What is triggers? Why you use trigger?

26) What is View? Why you use should use?

27) Difference between INNER and OUTER JOIN?

28) What are some situations where you would de-normalize data?

29) What is SQL injection and how do you prevent it?

30) What is the largest database system you've worked on in terms of: # tables, # rows, # users.

31) What is the timestamp datatype used for in SQL Server?

32) How do you remove duplicate rows from a result set?

33) What is Execution Plan? How does it help you?

34) What is a cursor and when would you use it (or not) and why?

35) What is difference between DELETE,  TRUNCATE,  and DROP in SQL? (Answer)

36) How to find top 10 records in Oracle database? (Answer)


That's all about the common Database questions for programmers and DBA. If you are going for any tech interview for Software developer or DBA position, I highly recommend you to go through these questions and see if you can answer them on your own or not. If you struggle to answer them then I would suggest you to go through these SQL and Database courses to revise the key SQL and Database concepts before interview. 


No comments:

Post a Comment