31 Top Database Testing Interview Questions and Answers

Our experts answered Most Frequently Asked Database Testing Interview Questions for Freshers and Experienced Candidates:

This is a collection of 30+ top DB testing interview questions with detailed answers. These DB testing questions are mostly asked in QA testing interviews.

Go through these questions and answers if you are preparing for software testing interview which also requires Database skills.

Database Testing

Top Database Testing Interview Questions

What type of database (SQL) questions asked in interviews for test engineer position (not for database tester)?

This depends on many factors whether these questions are for testing positions at entry-level or for experienced testing professionals. The depth of database interview questions depends on the experience of the candidate.

Irrespective of the position, the candidate should always be clear and confident about the database concepts. For most software testing positions, you need to have database knowledge to perform some database checks. Almost all applications need an interaction with a database.

Let’s consider these interview questions for entry-level software testing positions.

Following questions can be asked in interviews:

  • Basic, and to some extent nested SQL queries to fetch data from database tables.
  • Examples of database statements for Create Database, Create table and Drop Table.
  • Concept of “Primary Key”, “Foreign Key” and DB index.
  • Examples of SELECT, INSERT, DELETE, ALTER, and UPDATE SQL statements.
  • SQL joins (Inner Join, Left Join, Right Join and Full join) with examples.

Practice SQL join queries on dummy tables and see results.

For experienced level software testing positions, the interview questions depend on the job requirement. For such positions, interviewers expect detailed database knowledge from the candidates.

Note: If you get questions about database SQL queries, never say that “You get all query statements to be executed by developers”. It’s ok to say that you get help from developers to write complex SQL queries, but finally, you manage on your own.

Let’s start with actual DB questions and answers:

Q #1) What is Database testing?

Answer: Database testing/Back-end testing is a process of checking the impact of back-end database operation on front-end web/desktop applications.

It is divided into the following different categories:

  • Data Validity testing: While doing this testing, testers should have good knowledge of SQL queries.
  • Data Integrity testing: While doing this testing, testers/developers should know referential integrity and different constraints.
  • Database Performance testing: While doing this testing, testers/developers should be good in designing the structure of the table.
  • Testing of Procedure, Triggers, and Functions: While doing this testing, testers/developers should have a perfect understanding of the testing procedure, triggers, and functions.

Q #2) Why database testing is important?

Answer: Although we all know the database is not like a small table, it is indeed a big container of many tables and full of data that delivers data at the same time to many web/desktop applications.

The database testing process ensures that the correct and unique data (without bug) is delivered to the correct location. These bugs may cause some serious issues like deadlock, data corruption, poor performance, inconsistency, etc.

Q #3) In the Database Testing process, what do we usually check?

Answer: Database testing requires some in-depth knowledge and a more defined plan of approach to test the data of a particular application.

In this testing process we usually check,

  • The field size validation
  • Constraints.
  • Indexes are done or not (for performance-related issues)
  • Stored procedures
  • The field size defined in the application is matching with that in the DB.

Q #4) Can you test the database manually, if yes, then how? Explain with example.

Answer: It needs observing operation behavior. Observe the operations of the front-end and its effect on the back-end database. While adding a record (XYZ) from the front-end to the back-end database, manually check that the record has been affected on the back-end database or not. Similarly, it will work for delete, update, etc.

For Example, To keep the record of students who are giving exam, enter the student’s detail from the front-end system and manually check the effect of this addition on the back-end database.

Q #5) How to test database procedures and triggers?

Answer: The process of testing database procedures and triggers requires the knowledge of input parameters, output parameters, and EXEC statements. EXEC statement is helpful in running the procedure and observing the behavior of the tables.
Let’s see, how to test database procedures and triggers:

  • First, open the database project that will be displayed in the solution explorer.
  • Once the desired project is opened, go to the View menu, click on the database schema, and then open the project folder from the Schema View menu.
  • Right-click on the object that has to be tested, and then click on the Create Unit Tests. A dialog box “Create Unit Tests” opens and displays all the folders and objects of the database project and the checkbox for the selected object is checked.
  • Next, create a new language test project.
  • Choose to either insert the unit test in an existing test class or create a new test class and click on OK.
  • To configure the project, the Project Configuration dialog box appears to configure the test project settings. The process requires a database connection and data generation plan. The database connection is for executing the test result.
  • At last, configure the project and click on OK.

Q #6) What do you mean by data-driven tests?

Answer: Data-driven testing is a term used in the testing process where test scripts while execution read test data and/or output values from data files (Data pools, Excel files, ADO objects, CSV files, ODBC sources) instead of reading the same hard-coded values each time. The test helps testers in checking the efficiency of the application in handling various inputs.

Q #7) What is the database trigger, how to verify the trigger is fired or not and can you invoke the trigger on demand?


Database trigger: A trigger is basically a stored procedure used to maintain the integrity of the data present in the database. It executes automatically to respond to a certain event of a table/view in a database.

To verify the trigger is fired or not; use the query of the common audit log will display the trigger of the data table.
Triggers can’t be invoked on-demand, it is invoked when a table displays an action (INSERT, DELETE & UPDATE) defined on that particular table.

Q #8) After entering the data from the front-end application interface, how do you test whether a database is updated or not?

Answer: It totally depends on the application interface that you are using.

These are the following ways to test:

  • You can verify only from the front-end when the application interface shows a view functionality of the data you entered. Mainly, Black box test engineers do this functionality verification test in this manner.
  • If the application interface doesn’t provide view functionality of the data you entered, then you can check for database update by using relevant SQL/Oracle Query.
  • Checkpoint function of WinRunner/QTP can also be used to check for database update.

Q #9) How to test the Stored Procedures?

Answer: Test engineer needs to follow some steps to test the Stored Procedures,

  1. First, the test engineer should understand the requirement and also the purpose of a particular Stored Procedure.
  2. Next, verify whether all the indexes, joins, updates, deletions are precise in comparison with the tables mentioned in the Stored Procedure and also make sure that the Stored Procedure is in the common standard format, like comments, updated by, etc.
  3. Then, for different sets of input parameters, verify the procedure calling name, calling parameters, and expected responses.
  4. Manually, run the procedure with database client programs like TOAD, MySQL, or Query Analyzer.
  5. To verify results against expected values, re-run the procedure by giving different parameters.
  6. Finally, automate the tests with QTP.

Q #10) What are joins and mention different types of joins?

Answer: Join is used to combine two or more than two tables and displays as a single set of data.

In SQL, there are following types of joins:

  • Inner Join
  • Outer Join
  • Left Join
  • Right Join

In Oracle/PLSQL, there are four different types of joins,

  • Inner Join
  • Left-Outer Join
  • Right-Outer Join
  • Full-Outer Join

Q #11) What do you mean by index and explain different types of indexes?

Answer: An Index is a database object, created on a column of the table to find data more quickly and efficiently (or we can say, it is used to speed up the searches/queries).

Different types of indexes are:

  • B-Tree index
  • Bitmap index
  • Clustered index
  • Covering index
  • Non-unique index
  • Unique index

Q #12) What do you mean by DBMS?

Answer: A database is a structured set of data. Database Management System (DBMS) is a computer software application that creates a communication network between users, other applications and the database to store, modify, and extract information from a database.

Famous DBMSs are My SQL, Postgre SQL, Microsoft SQL Server, Oracle, SAP, and IBM DB2.

Q #13) What do you mean by DML?

Answer: Data Manipulation Language (DML) is a member of computer programming language that facilitates us to select, insert, delete and update data in a database. DML is basically involved in Structured Query Language (SQL) that facilitates users to retrieve and use data in a relational database.

Q #14) What do you mean by DCL commands and explain the types of commands used by DCL?

Answer: Data Control Language (DCL) is a component of SQL, controls the use of data stored in a database.

There are two types of DCL Commands:

  • Grant: The command facilitates users to access privilege to database
  • Revoke: Stop permitting users to access the database

Q #15) What do you mean by white box testing and black box testing?


Black-box testing is a software testing technique to test the functional behavior of an application without getting into its internal structures of an application. Core application’s code/internal structure and programming knowledge are not required for black-box testing, but core knowledge of application functionality is required to test the application.

White Box Testing (WBT) is also known as Code-Based Testing or Structural Testing to test the internal structure of a software application. In the case of white-box testing, the tester should have a good understanding of the internal structure of an application as well as good knowledge of programming skills to design test cases and internal structure of an application.

Q #16) Does QTP support SQL queries, how to use SQL queries in QTP?

Answer: Although QTP doesn’t carry any built-in function for database connectivity, testers uses VBScript language to connect and interact with databases using ADODB objects.
ADODB objects are divided into four different properties/methods which helps in successfully creating a database connection,

  • Connection: Useful in forming a connection with a Database
  • Command: Useful in executing a SQL command(Queries/Stored Procedures)
  • Fields: Useful in retrieving a particular column from a record-set after executing a Query/Stored Procedure.
  • Recordset: Used to retrieve data from a database

Q #17) Which SQL statements can be used in Database Testing?

Answer: All DDL, DML, DCL, and TCL statements of SQL can be used in database testing,

(i) DDL (Data Definition Language): All statements related to this can be used in defining the database structure or schema.


(ii) DML (Data Manipulation Language): All statements related to this can be used for managing data within schema objects.


(iii) DCL (Data Control Language): GRANT Statement and REVOKE Statement.

(iv) TCL (Transaction Control Language): All statements related to this can be used to manage the changes made by DML statements. Using TCL, statements can be grouped together into logical transactions.


Q #18) In database testing, how to do the data load testing?

Answer: For data load testing,

  • You need to have knowledge of source database (data tables, columns, associated constraints, data types) and destination database (data tables, columns, data types, and constraints).
  • You need to check the compatibility between the source database and destination database via the DTS package.
  • You need to Open corresponding DTS package in SQL Enterprise Manager and run the DTS package (if you are using SQL Server).
  • Compare the column’s data of Source and the Target.
  • Check the number to rows of Source and Target.
  • After updating data in the Source database, check whether the changes have been reflected on the destination database or not.
  • Check about junk character and NULLs.
  • Database load testing, check the volume of the database server to process the queries and also check the response time of database server and client.

Q #19) Is a “A fast database retrieval rate” a testable requirement?

Answer: No. I don’t think so because the requirement appears to be unclear. The SRS should clearly display the performance or transaction requirements, i.e. It should mention like; “Database retrieval rate of 5 microseconds”.

Q #20) Without involving database checkpoints, how you can test a SQL Query in QTP?

Answer: The given below script procedure help us in connecting to the database where we can test both; the database and queries.

a) The script procedure for database connection,
db_connect(“query1”,DRIVER={driver name};SERVER=server_name;

UID=uidname;PWD=password;DBQ=database_name “);

b) The script procedure to execute the query,
db_excecute_query(“query1″,”write query u want to execute”);

-Condition to be mentioned-

c) The script procedure to disconnect the connection with the database,

Q #21) In database testing, what all things are required for writing good test cases?

Answer: Knowledge of following things is required before writing the database test cases,

  1. Understand the application completely and also the functional requirement of the application.
  2. Check-out other entities that have been used in an application like back-end database tables, joins between the tables, cursors (if any), triggers (if any), stored procedures (if any), input parameter and output parameters for developing that requirement.
  3. After collection of all necessary information, write down the test case with different input values for examining all the resources.

Writing test cases for back-end testing is opposite to functional testing, one should use the white box testing technique.

Q #22) What is retesting & how it is different from data-driven testing?

Answer: After the execution of the test in terms of finding the defect that has been already detected and fixed, re-execution of the same test with different input values to confirm the original defect has been successfully removed is called Re-testing or confirmation Testing.

Retesting is also called Data-Driven Testing, but the difference between both is, Retesting is a manual testing process whereas application testing done with the entire new set of data.

Data-Driven Testing(DDT): It is an Automation testing process where an application will be tested with multiple test data.It is simple and easy than retesting where tester just sits in front of the system and enter different new input values manually from front-end interface, it is really a boring technique.

Q #23) What are the types of data-driven testing?


There are four types of data-driven testing:

  • Dynamic test data submission through the keyboard (key-driven test): In some cases, testers retest a particular application with different input values to validate the calculation via dynamic submission. So, to submit the input value, testers can use the following function in TSL; script– create_input_dialog (“label”);
  • Data-Driven Tests via flat files (.txt,.doc): In some cases, testers do the re-testing by considering the data of the flat file. Testers gather those flat files from old databases/customers.
  • Data-Driven Tests via front-end objects: In some cases, testers create automation scripts by considering the front-end object values, such as list, menu, table, data window, ocx, etc.
  • Data-Driven Tests via excel sheet: In some cases, testers take the help of this data-driven test to run the script for multiple inputs. These multiple inputs reside in columns of an excel sheet. We have to collect this test data from the backend tables.

Q #24) How to write a query to get the second largest value from a given column of a table?

Answer: This is a query to get the second largest value from a given column of a table.


For Example,
To get the second-largest marks from “Marks” column of a “Students” table

SELECT Max(Marks) from Students
WHERE Marks< (SELECT Max(Marks) from students);

Q #25) How to write a query to get the 10th highest salary from an employee table?

Answer: This is a query to get nth highest salary from an employee table,

FROM Employee Emp1
WHERE ( n ) = (
SELECT COUNT( DISTINCT ( Emp2.Employee_Salary ) )
FROM Employee Emp2
WHERE Emp2.Employee_Salary >= Emp1.Employee_Salary

Here, you can replace them with any number.

For Example, if you want to get 10th the highest salary, then replace n with 10.

FROM Employee Emp1
WHERE (10) = (
SELECT COUNT( DISTINCT ( Emp2.Employee_Salary ) )
FROM Employee Emp2
WHERE Emp2.Employee_Salary >= Emp1.Employee_Salary

Q #26) How to write test cases from requirements, do the requirements signify the exact functionality of AUT?

Answer: Yes, the requirements should signify the exact functionality of AUT.
To do so,

  1. Examine the requirement to understand overall functionality.
  2. Next, decide which test design methods are suitable to write test case – Black Box test design methods like; Equivalence Partitioning, Boundary Value Analysis, Error Guessing and Cause-Effect Graphing.
  3. Once you decide which test design method is suitable, write your test cases in requirement analysis and design phase.

In this way, you will ensure that all the requirements are testable.

Q #27) What is the test scenario to test a database migrated from one SQL Server to another?

Answer: First of all, we need to check what all enhancements and changes happened to the SQL Server where we are planning to migrate.
Next, design the test case according to the following consideration,

  • A data type that has been used.
  • Length of the data field of SQL Server (Server into which we are migrating the data) should be same as the SQL Server from where we are taking out the data.
  • Each and every task should be organized correctly.

Q #28) What does the RDBMS stand for and what are the major RDBMS used by SQL?

Answer: RDBMS stands for Relational Database Management Systems. Major RDBMS that is involved with SQL includes Sybase, Oracle, Access, Ingres, Microsoft SQL Server, etc.

Q #29) Explain performance testing and the bottlenecks of it.

Answer: Performance testing is a software testing technique to determine how a system performance in terms of speed, sensitivity, and stability under a heavy workload. This testing requires expensive tools and well-trained and experienced testers for operation.

Q #30) What is CMMI and describe different levels of CMM?

Answer: CMMI stands for Capability Maturity Model Integration is a process development training and evaluation model of various business processes in software engineering.

Five CMM Maturity levels for an organization are:

  1. Initial: At this level, organizations don’t have any verified technique and environment, so usually organizations budget and schedule time go over.
  2. Repeatable: At this level, organizations have basic techniques and guidelines to limit the cost and schedule time, capable of repeating the same in the next similar project.
  3. Defined: At this level, all techniques are well organized and explained clear and standard form.
  4. Managed: At this level, organizations are much more developed than the Defined level. Here, techniques are contacted using statistical and other quantitive technique.
  5. Optimizing: Organizations determinedly attempt to develop performance via modern technical progress.

Q #31) What is the meaning of the Record in a database?

Answer: In a database, a record is the set of values/fields of a specific entity.

For Example, Office_Employee Record, Book Record, etc.

We hope you like these detailed Database interview questions with answers. Let us know in case of any queries.

1 thought on “31 Top Database Testing Interview Questions and Answers”

Comments are closed.