Introduction

SQL test cases for banking application help QA testers verify account balances, money transfers, deposits, withdrawals, and transaction history. Banking applications handle sensitive financial data, so testers must ensure that every transaction is processed correctly and database records remain accurate.

Banking applications handle important financial activities such as money transfers, deposits, withdrawals, balance checks, and transaction history. Even a small error in a banking application can affect customer accounts and financial records.

As a software tester, you need to verify not only the application’s user interface but also the data stored in the database. This is where SQL testing becomes useful.

SQL testing helps testers check whether the correct data is stored, updated, retrieved, and deleted in the database.

In this blog, we will explore important SQL test cases for a banking application with simple examples that beginners can understand and practice.

What Is SQL Testing in Banking Applications?

SQL testing is the process of validating database operations using SQL queries.

For example, when a customer transfers ₹5,000 from one bank account to another, the application should:

A QA tester can use SQL queries to verify these database changes.

Important SQL Test Cases for Banking Application

Before writing SQL test cases, let’s assume our banking application has the following database tables.

1. Customers Table

customer_idcustomer_namestatus
101Amit SharmaActive
102Priya PatilActive
103Rahul VermaInactive

2. Accounts Table

account_idcustomer_idbalance
100110120000
100210215000
10031035000

3. Transactions Table

transaction_idfrom_accountto_accountamountstatus
501100110022000Success
502100110031000Failed

Note: These tables and records are sample data created for learning purposes.

Important SQL Test Cases for a Banking Application

Test Case 1: Verify Customer Details

Objective: Verify that customer information is stored correctly in the database.

SQL query:

SELECT *
FROM Customers
WHERE customer_id = 101;

Expected result:

The query should return the correct customer record, including the customer ID, name, and status.

What should a tester check?

Test Case 2: Verify Account Balance

Objective: Check whether the account balance displayed in the application matches the database.

SQL query:

SELECT account_id, balance
FROM Accounts
WHERE account_id = 1001;

Expected result:

The account balance should be ₹20,000, based on the sample data.

What should a tester check?

Test Case 3: Verify Money Transfer

Objective: Verify whether the sender’s and receiver’s balances are updated correctly after a successful transfer.

Suppose the sender transfers ₹2,000 to the receiver.

SQL query:

SELECT account_id, balance
FROM Accounts
WHERE account_id IN (1001, 1002);

Expected result:

If the initial balances were ₹20,000 and ₹15,000, the expected balances after a successful transfer would be:

The tester should also verify that the transfer is recorded successfully in the Transactions table.

Test Case 4: Verify Transaction History

Objective: Ensure that the transaction history contains the correct details.

SQL query:

SELECT *
FROM Transactions
WHERE from_account = 1001;

Expected result:

The query should return the transactions associated with the sender’s account.

What should a tester check?

Test Case 5: Verify Failed Transactions

Objective: Ensure that a failed transaction does not incorrectly reduce the sender’s balance or increase the receiver’s balance.

SQL query:

SELECT *
FROM Transactions
WHERE transaction_id = 502;

Expected result:

The transaction status should be Failed.

The tester should also compare account balances before and after the failed transaction to confirm that no unintended money movement occurred.

Test Case 6: Verify Insufficient Balance

Objective: Check whether the application prevents a customer from transferring more money than the available balance.

Suppose an account has ₹5,000, and the customer tries to transfer ₹8,000.

SQL query:

SELECT balance
FROM Accounts
WHERE account_id = 1003;

Expected result:

The application should reject the transfer if the available balance is insufficient and the applicable banking rules do not permit overdrawing.

The account balance should remain unchanged, and the failed attempt should be recorded according to the application’s transaction and audit requirements.

Pages: 1 2

Leave a Reply

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