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 checking whether data inserted through UI, APIs, or batch jobs is correctly stored, updated, retrieved, and deleted.
In service-based IT companies like Cognizant, projects deal with large enterprise databases across domains such as banking, healthcare, insurance, and retail. That’s why cognizant database testing interview questions are a key part of QA and testing interviews.
Why Database Testing Is Important in Cognizant Projects
- To validate UI/API data vs database records
- To ensure business rules are enforced at DB level
- To prevent data loss, duplication, or corruption
- To maintain audit trails and transaction accuracy
Step-by-Step Database Testing Workflow
1. Understand Business Requirements
- What data is created or updated?
- Which fields are mandatory?
- What calculations happen in the database?
2. Schema & Table Validation
- Table and column names
- Data types and 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)
Cognizant 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 Cognizant projects?
Because Cognizant works on enterprise-scale applications where data accuracy directly impacts business decisions.
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 establishes a relationship between two tables.
7. What is data integrity?
Ensuring data accuracy and consistency across tables.
8. What is normalization?
Reducing data redundancy.
9. What is denormalization?
Adding redundancy for 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 creation 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 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 Cognizant 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 – Cognizant Database Testing Interview Questions
Q1. Is SQL mandatory for Cognizant testing interviews?
Yes, SQL is a core requirement.
Q2. Are scenario-based questions common?
Yes, scenario based database testing questions with answers are frequently asked.
Q3. Which databases are commonly used?
Oracle, MySQL, SQL Server, PostgreSQL.
