Database testing questions come up in manual testing, automation and ETL testing interviews alike. These 35 database testing interview questions and answers cover what interviewers in India ask most, from fresher basics to scenario questions for experienced testers.
Database Testing Basics (Q1–Q10)
1. What is database testing?
Testing the data, schema and database objects behind an application: that data is stored correctly, constraints and rules hold, and procedures, triggers and transactions work as specified.
2. Why is database testing important?
A screen can show "Saved" while the database stores wrong or partial data. Database testing catches data loss, corruption and rule violations the UI hides.
3. What are the types of database testing?
Structural (schema, tables, columns, keys, indexes), functional (procedures, triggers, CRUD behaviour) and non-functional (performance, load, security).
4. What is CRUD testing?
Verifying Create, Read, Update and Delete operations from the application are correctly reflected in the database.
5. What is a primary key vs a unique key?
Both enforce uniqueness. A table has one primary key and it cannot be NULL; it can have several unique keys, which allow NULLs in most databases.
6. What is a foreign key?
A column that references a primary key in another table, enforcing referential integrity.
7. What are ACID properties?
Atomicity (all or nothing), Consistency (rules always hold), Isolation (concurrent transactions do not interfere) and Durability (committed data survives failures).
8. What is normalisation?
Organising tables to reduce redundancy and update anomalies, typically up to third normal form in transactional systems.
9. What is an index and why test it?
A structure that speeds up lookups. Testers check that expected indexes exist and that key queries meet performance targets.
10. Database testing vs ETL testing?
Database testing checks one application database; ETL testing checks data moving between systems into a warehouse. See ETL vs database testing.
SQL Questions (Q11–Q18)
11. How do you verify a record saved from the UI?
Query the table by the business key used in the test (for example the order number) and compare every stored column with the input and expected defaults.
12. How do you find duplicate rows?
GROUP BY the key columns with HAVING COUNT(*) > 1.
13. What is the difference between DELETE, TRUNCATE and DROP?
DELETE removes chosen rows and is logged; TRUNCATE removes all rows quickly; DROP removes the table structure.
14. What are joins? Name the types.
Joins combine rows from tables on a related column: INNER, LEFT, RIGHT, FULL OUTER and CROSS.
15. UNION vs UNION ALL?
UNION removes duplicates; UNION ALL keeps them.
16. How do you find the Nth highest salary?
Use DENSE_RANK() over salary descending and filter for rank N.
SELECT salary FROM ( SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk FROM employees ) t WHERE rnk = 3;
17. What is a view?
A saved query that behaves like a virtual table. Test that it returns the right rows and columns and respects security.
18. How do you find records in one table but not another?
LEFT JOIN with WHERE right.key IS NULL, or EXCEPT/MINUS on the keys.
Stored Procedures and Triggers (Q19–Q24)
19. How do you test a stored procedure?
Call it with valid, boundary and invalid parameters; check returned results, output parameters, rows changed in each affected table and error handling.
20. How do you test a trigger?
Perform the triggering action (insert, update, delete) and verify the trigger's effect, such as an audit row being written, including for multi-row operations.
21. What is a transaction and how do you test rollback?
A unit of work that commits or rolls back entirely. Force a failure mid-transaction and confirm no partial changes remain.
22. What is a deadlock?
Two transactions each waiting for a lock the other holds. Tested with concurrent sessions during performance testing.
23. How do you test default values and constraints?
Insert rows omitting defaulted columns, and try to insert values that violate NOT NULL, CHECK, UNIQUE and foreign key constraints; the database should reject them.
24. What are audit columns?
Columns such as created_by, created_at and updated_at. Verify they are set correctly on insert and update.
Data Integrity and Security (Q25–Q30)
25. What is data integrity?
Accuracy and consistency of data over its life, enforced by constraints, transactions and validation.
26. What is referential integrity testing?
Checking that every foreign key value has a matching parent row and that deletes and updates behave as designed (restrict, cascade or set null).
27. What is SQL injection and how do testers check for it?
An attack that injects SQL through input fields. Testers try special characters and SQL fragments in inputs and confirm the application uses parameterised queries and rejects them safely.
28. How do you test database access permissions?
Log in with different roles and confirm each can only read or change what it is allowed to.
29. How do you test data masking?
In non-production copies, verify sensitive fields such as PAN, Aadhaar or card numbers are masked consistently and cannot be reversed.
30. What is orphan data?
Child rows whose parent no longer exists. Find them with a LEFT JOIN to the parent where the parent key IS NULL.
Scenario Questions (Q31–Q35)
31. The UI shows an order, but the report does not. Where do you look?
Check the order table, then the status and dates the report filters on, then any downstream load into the reporting database.
32. A bulk upload of 10,000 rows stored 9,987. What do you do?
Find the 13 missing keys with EXCEPT, check reject logs and constraint errors, and log a defect with sample rows.
33. How do you test a database upgrade?
Compare schema objects, row counts and key totals before and after, re-run procedures and regression tests, and check performance.
34. How do you test with large data volumes?
Generate or copy realistic volumes, time key queries and procedures, and check indexes and execution plans.
35. How would you prepare test data?
Write SQL inserts or scripts covering valid, boundary, invalid and edge cases, and clean up or reset after tests.
Moving toward data roles? Database testing skills transfer directly to ETL testing. Practise with the ETL Testing Interview Questions & Answers – Practice Tests, and read SQL for testers.
Prepare for your ETL testing interview: top 50 questions · in-depth answers · for experienced (3–5 years) · for 10 years experience · SQL query questions · scenario-based questions · data warehouse questions · questions for freshers · free mock test
Data testing skills: SQL for testers · data migration testing · Power BI testing · big data testing · data quality checks · ETL tools list · ADF & Databricks testing
Frequently Asked Questions
What is asked in a database testing interview?
SQL queries (joins, GROUP BY, duplicates, Nth highest), keys and constraints, ACID and transactions, stored procedures and triggers, data integrity and scenario questions about mismatched data.
What is database testing in software testing?
It is testing the data and database objects behind an application to ensure data is stored, updated and retrieved correctly and that rules and constraints hold.
Which tools are used for database testing?
SQL clients such as SSMS, SQL Developer, DBeaver or MySQL Workbench, plus test management tools and scripting in Python or Java for automation.
Is database testing a good career?
Database testing skills are valued in QA, and they lead naturally to ETL testing and data warehouse testing roles, which are more specialised.
How should freshers prepare for database testing interviews?
Practise SQL daily on sample tables, learn keys, constraints and ACID, and prepare short answers on testing procedures, triggers and CRUD operations.
Asim Noaman Lodhi
Certified Google Partner · QA Consultant · 12+ Years IT
QA consultant specializing in ETL testing and data quality. Trained 913+ students to transition into data testing roles through hands-on, real-world instruction.