What Is Database Testing?
Database testing is the process of validating backend data stored in databases to ensure it is accurate, consistent, secure, and aligned with business rules. It focuses on verifying that data created through UI, APIs, or batch jobs is correctly stored, updated, retrieved, and deleted.
In large service-based organizations like Cognizant (popularly known as CTS), applications handle huge enterprise databases across banking, healthcare, insurance, and retail domains. Therefore, cts database testing interview questions are a key part of QA, manual testing, and automation testing interviews.
Why Database Testing Is Important in CTS Projects
- To validate UI/API vs database data
- To ensure business rules are enforced at DB level
- To prevent data duplication or data loss
- To maintain transaction accuracy and audit logs
Step-by-Step Database Testing Workflow
1. Understand Business Requirements
- What data is created or updated?
- Which fields are mandatory?
- What calculations are performed in DB?
2. Schema & Table Validation
- Table and column names
- Data types and field lengths
- Default values
3. Constraint Validation
- Primary Key
- Foreign Key
- NOT NULL
- UNIQUE
4. CRUD Validation
| Operation | Purpose | SQL Used |
| Create | Insert data | INSERT |
| Read | Fetch data | SELECT |
| Update | Modify data | UPDATE |
| Delete | Remove data | DELETE |
5. Advanced Database Validation
- Indexes (performance)
- Stored Procedures (business logic)
- Triggers (audit & logging)
- Transactions (commit/rollback)
CTS Database Testing Interview Questions (100+ Q&A)
Basic Database Testing Interview Questions (1–20)
1. What is database testing?
Database testing validates backend data using SQL queries to ensure accuracy and integrity.
2. Why is database testing important in CTS projects?
CTS works on enterprise-scale applications where incorrect data can lead to business or compliance issues.
3. What skills are required for database testing?
- SQL knowledge
- Understanding of database concepts
- Business logic understanding
4. What is CRUD?
- Create – INSERT
- Read – SELECT
- Update – UPDATE
- Delete – DELETE
5. What is a primary key?
A column that uniquely identifies each record.
6. What is a foreign key?
A column that creates a relationship between two tables.
7. What is data integrity?
Ensuring accuracy and consistency of data across tables.
8. What is normalization?
Reducing data redundancy.
9. What is denormalization?
Adding redundancy to improve performance.
10. What is a schema?
A logical container for database objects.
SQL Interview Questions for Testing (21–45)
21. Fetch all records from a table
SELECT * FROM users;
22. Fetch users with age greater than 30
SELECT * FROM users WHERE age > 30;
23. Fetch unique city names
SELECT DISTINCT city FROM customers;
24. Sort records by created date
SELECT * FROM orders ORDER BY created_date DESC;
25. What is GROUP BY?
Groups rows with the same values.
SELECT department, COUNT(*)
FROM employees
GROUP BY department;
26. What is HAVING?
Filters grouped data.
SELECT department, COUNT(*)
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;
27. Difference between WHERE and HAVING?
| WHERE | HAVING |
| Filters rows | Filters grouped data |
| Used before GROUP BY | Used after GROUP BY |
JOIN-Based CTS Database Testing Interview Questions (46–65)
46. What is a JOIN?
Used to retrieve data from multiple tables.
47. Types of JOINs
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- FULL JOIN
48. INNER JOIN example
SELECT o.order_id, c.name
FROM orders o
INNER JOIN customers c
ON o.customer_id = c.id;
49. LEFT JOIN use case
Find records without matching data.
SELECT c.name, o.order_id
FROM customers c
LEFT JOIN orders o
ON c.id = o.customer_id;
50. Scenario: Customers with no orders
SELECT c.id
FROM customers c
LEFT JOIN orders o
ON c.id = o.customer_id
WHERE o.id IS NULL;
Indexes, Stored Procedures & Triggers (66–85)
66. What is an index?
Improves query performance by reducing table scans.
67. Types of indexes
- Clustered
- Non-clustered
- Composite
68. How do testers validate index usage?
By checking execution plans using EXPLAIN.
69. What is a stored procedure?
Pre-compiled SQL code stored in the database.
70. Stored procedure example
CREATE PROCEDURE getUser(IN uid INT)
BEGIN
SELECT * FROM users WHERE id = uid;
END;
71. How do testers test stored procedures?
- Input validation
- Output verification
- Error handling
72. What is a trigger?
Automatically executes SQL on INSERT/UPDATE/DELETE.
73. Trigger example
CREATE TRIGGER audit_update
AFTER UPDATE ON orders
FOR EACH ROW
INSERT INTO audit_log VALUES (NEW.id, NOW());
Scenario Based Database Testing Interview Questions (86–110)
86. Scenario: Validate user registration
- Record inserted
- Default values assigned
SELECT * FROM users WHERE email=’test@gmail.com’;
87. Scenario: Validate update operation
SELECT address FROM users WHERE id=101;
88. Scenario: Validate soft delete
SELECT * FROM users WHERE is_active=’N’;
89. Scenario: Detect duplicate records
SELECT email, COUNT(*)
FROM users
GROUP BY email
HAVING COUNT(*) > 1;
90. Scenario: Validate banking transaction
- Debit entry
- Credit entry
- Balance updated
SELECT balance FROM accounts WHERE acc_id=101;
91. Scenario: Validate rollback
- Force failure
- Ensure no partial data saved
Advanced Database Testing Interview Questions (111–130)
111. What is a transaction?
A group of SQL statements executed as a single unit.
112. What are ACID properties?
- Atomicity
- Consistency
- Isolation
- Durability
113. What is a deadlock?
Two transactions waiting indefinitely for each other.
114. What is isolation level?
Controls visibility of uncommitted data.
115. What is data migration testing?
Validating data accuracy after migration.
Real-Time Use Cases in CTS Projects
🏦 Banking
- Transaction accuracy
- Balance calculation
- Audit log validation
🏥 Healthcare
- Patient data integrity
- Medical history consistency
- Compliance checks
🛒 E-commerce
- Order vs payment reconciliation
- Inventory updates
- Refund processing validation
Common Mistakes Testers Make
- Validating only UI data
- Ignoring NULL and default values
- Skipping rollback scenarios
- Missing negative test cases
- Not validating performance
Quick Revision Sheet
✔ SELECT, WHERE, ORDER BY
✔ JOIN types
✔ GROUP BY, HAVING
✔ CRUD operations
✔ Index basics
✔ Stored procedures
✔ Triggers
✔ Transactions
FAQs – CTS Database Testing Interview Questions
Q1. Is SQL mandatory for CTS database testing interviews?
Yes, SQL is a core skill for CTS testing roles.
Q2. Are scenario-based questions common?
Yes, scenario based database testing questions with answers are frequently asked.
Q3. Which databases are commonly used in CTS projects?
Oracle, MySQL, SQL Server, PostgreSQL.
