QAPage – Software Testing Jobs, QA Resources & Careers

QAPage Navigation & Directory
Type any keyword to search live pages, tools, or press Search to query site-wide.

Database Testing Full Notes PDF for QA: Complete Guide for Beginners

Database Testing Full Notes PDF For QA

Beginner to Experienced QA Testers

Database Testing Notes For QA: Database Testing means checking whether the data stored in a database is correct, complete, consistent, and secure. These notes cover the important concepts in simple language, with practical examples and interview points.

1. What is Database Testing?
Database Testing is the process of verifying that data is stored, updated, retrieved, and deleted correctly in a database.
Simple example: You register on a website using your name and email address. After registration, a tester checks whether the correct name and email have been saved in the database.

2. Why is Database Testing important?

  • To verify data accuracy.
  • To ensure no data is missing.
  • To check that updates are saved correctly.
  • To identify duplicate records.
  • To verify relationships between tables.
  • To ensure data security and access permissions.
  • To check that the application and database show consistent information.

3. What is a Database?

A database is an organized collection of data that can be stored, accessed, and managed.
For example, an employee database may contain employee IDs, names, email addresses, departments, and salaries.

Important database terms

Term
Simple meaning
Database
Collection of organized data
Table
Data arranged in rows and columns
Row
One complete record
Column
One type of information
Primary Key
Uniquely identifies a record
Foreign Key
Connects related tables
SQL
Language used to communicate with a database
DBMS
Software used to manage databases
Schema
Structure and organization of a database
NULL
Missing or unknown value

4. Types of Database Testing

Database Testing Notes for QA
1. Data Integrity Testing
Checks whether data remains correct and complete.
Example: A customer’s email should not change unless an update is performed.
Database Testing Notes for QA
2. Structural Testing
Checks tables, columns, data types, keys, constraints, and relationships.
Example: Employee ID should be a number or another defined identifier type, as specified by the schema.
Database Testing Notes for QA
3. Functional Database Testing Notes For QA
Checks whether database operations work according to business requirements.
Example: After an employee’s department is changed, the correct department should be stored.
Database Testing Notes for QA
4. Security Testing
Checks permissions and protection of sensitive data.
Example: A regular employee should not be able to view restricted salary records.
Database Testing Notes for QA
5. Performance Testing
Checks how efficiently the database handles queries and large volumes of data.
Example: A report that normally loads in two seconds should not take 30 seconds under expected conditions.

5. CRUD Operations in Database Testing

CRUD stands for Create, Read, Update, and Delete.
Operation
SQL command
Purpose
Create
INSERT
Add a record
Read
SELECT
Retrieve records
Update
UPDATE
Modify a record
Delete
DELETE
Remove a record
Example table: Employees
EmployeeID
Name
Department
101
Amit
QA
102
Priya
Development
103
Rahul
Support

6. Important SQL Queries for Testers

SELECT — Read data

SELECT * FROM Employees;
Displays all columns and records in the table.

WHERE — Find specific data

SELECT * FROM EmployeesWHERE EmployeeID = 101;
Returns the employee with ID 101.

INSERT — Add data

INSERT INTO Employees(EmployeeID, Name, Department)VALUES (104, 'Neha', 'QA');
Adds a new employee, assuming the table allows these values.

UPDATE — Modify data

UPDATE EmployeesSET Department = 'Testing'WHERE EmployeeID = 101;
Changes the department for employee 101.

DELETE — Remove data

DELETE FROM EmployeesWHERE EmployeeID = 104;
Deletes employee 104.
Important: Always verify the WHERE condition before running UPDATE or DELETE, particularly in shared or production databases.

7. SQL Concepts You Must Know

Concept
What it does
ORDER BY
Sorts query results
GROUP BY
Groups records for analysis
COUNT()
Counts records
SUM()
Adds numeric values
DISTINCT
Returns unique values
LIKE
Searches using a pattern
IN
Matches values in a list
BETWEEN
Checks a range
INNER JOIN
Returns matching records from both tables
LEFT JOIN
Returns all left-table records and matching right-table records
Subquery
A query inside another query
HAVING
Filters grouped results
Example — count employees by department:
SELECT Department, COUNT(*)FROM EmployeesGROUP BY Department;

8. Primary Key, Foreign Key and Constraints

  • Primary Key: Uniquely identifies each record. Duplicate or NULL values are not allowed.
  • Foreign Key: Maintains a relationship with a key in another table.
  • Unique: Prevents duplicate values in a column or combination of columns, subject to database rules for NULLs.
  • NOT NULL: Prevents a column from storing NULL.
  • CHECK: Restricts values according to a condition.
  • DEFAULT: Supplies a value when one is not provided and the database rules allow it.
Example: An EmployeeID can be a primary key, while DepartmentID can reference a department table.
Interview point: A foreign key helps prevent invalid references, such as assigning an employee to a department that does not exist, when the relevant constraint is enforced.

9. Database Testing vs UI Testing vs API Testing

Testing type
What you check
UI Testing
What the user sees on the screen
API Testing
Data sent and returned through API requests
Database Testing
What is actually stored in the database
Real-time example: A user changes their email address on a website.
  1. UI testing verifies that the email field accepts the new address.
  2. API testing verifies the update request and response.
  3. Database testing verifies that the correct email is saved and the old value is no longer stored where it should not be.

10. Real-Time Database Testing Scenarios

These are important for both freshers and experienced testers.
  1. Verify that registration data is saved correctly.
  2. Verify that updated information persists after refreshing or reopening the application.
  3. Check whether duplicate email addresses are allowed according to requirements.
  4. Verify that deleting a record produces the expected database result.
  5. Check whether NULL values are accepted in optional and mandatory columns.
  6. Verify primary key and foreign key relationships.
  7. Check whether a failed transaction leaves partial or inconsistent data.
  8. Verify that totals displayed in a report match the database calculation.
  9. Check whether unauthorized users can access restricted records.
  10. Verify that bulk data imports do not skip or duplicate records.
  11. Check that date, time, currency, and decimal values are stored accurately.
  12. Verify that application and database values remain consistent after API operations.

11. Database Testing Interview Questions

1. What is database testing?
2. What is the difference between DELETE, TRUNCATE and DROP?
3. What is the difference between WHERE and HAVING?
4. What is a JOIN?
5. What is data integrity?
6. How do you test whether an update is saved?
7. What is a transaction?
8. What are ACID properties?
9. What is normalization?
10. What is an index?
11. How do you find duplicate records?
12. How do you report a database defect?

12. What should beginners and experienced testers focus on?

For beginners / freshers

  • Database basics, tables, rows and columns
  • SELECT, WHERE, INSERT, UPDATE and DELETE
  • Primary keys, foreign keys and constraints
  • Basic JOINs and aggregate functions
  • Simple data validation scenarios

Database Testing Notes For experienced testers

  • Complex joins, subqueries and query analysis
  • Transactions, ACID and rollback validation
  • Data migration and reconciliation
  • API-to-database and UI-to-database validation
  • Concurrency, locking and deadlocks
  • Performance, indexing and execution plans
  • Security, access control and sensitive data handling

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top