• Finance
  • 3 tables
  • 41,366 rows
  • 7 formats
  • SQL edition
  • synthetic data

Banking Dataset for SQL Practice

This ready-made banking dataset is designed for analysts practicing SQL. It contains 41,366 rows across 3 tables, covering customer information, account details, and financial transactions. Analyze account balances, transaction patterns, and customer behavior within the date range of 2022-01-01 to 2023-12-31.

  • last updated 4 Oct 2026
  • by GoMask
  • Dataset includes 3 tables: customers, accounts, and transactions.
  • Contains 41,366 total rows of synthetic banking data.
  • Covers transactions from 2022-01-01 to 2023-12-31.
  • Customer data includes ID, name, city, and country (USA).
  • Account data includes ID, type (Checking, Savings, etc.), balance, and customer ID.
  • Transaction data includes ID, date, type, amount, and account ID.

At a glance

  • 3tables
  • 41,366rows
  • 14columns
  • Jan 2022 – Dec 2023date range

The 3 tables

preview and data dictionary per table

Customers customers · dimension table · 1,000 rows

Contains information about 1,000 banking customers.

Preview

First 10 of 1,000 rows of the Customers table
customer_iduuidfirst_namestringlast_namestringcitystringcountrystring
7e3675aa-1a40-4d95-8168-e8349e87334bPenelopeThompsonPhiladelphiaUSA
3f40ade4-21df-470b-a0c2-28aadfd30b25SophiaJohnsonColumbusUSA
5f765331-a9b8-46bf-961c-1b6b38b0e09cEmmaPattersonIndianapolisUSA
0a037b2b-79d2-4a2b-94c2-00e7286dbfaeAvaTaylorDetroitUSA
9594668e-7ba4-441f-b5bb-9b069c1e7326IsabellaJacksonBaltimoreUSA
fe6c0677-8787-44ee-b0f9-17186b56f8b6MiaPetersonLouisvilleUSA
3bbe022f-9d5b-40ef-8d3a-2d94ec522127CharlotteThomasPhiladelphiaUSA
d8e13ccd-e538-4c97-81c6-c10d95abf9c8AmeliaJenkinsColumbusUSA
fd9abd04-426f-49a2-be78-122d3ca93c0cHarperParkerIndianapolisUSA
e28b2c96-e8fa-4c97-bb70-d468e70eda58EvelynTurnerDetroitUSA
10 of 1,000 rows · 5 columns

Data dictionary

Data dictionary for the Customers table
columntypedescriptionexamplenull %
customer_iduuidUnique identifier for each banking customer.unique7e3675aa-1a40-4d95-8168-e8349e87334b0%
first_namestringCustomer's given first name.Penelope0%
last_namestringCustomer's surname or family name.Thompson0%
citystringCustomer's residential city in the United States.Philadelphia0%
countrystringCustomer's country of residence, fixed to USA.USA0%

Accounts accounts · table · 3,000 rows

Details of 3,000 bank accounts, linked to customers.

Preview

First 10 of 3,000 rows of the Accounts table
account_iduuidaccount_typestringbalancedecimalcustomer_iduuid
6c48e9de-46ab-4c4c-b1f9-e52c283ace6dChecking2570.537a9c445f-9d10-43b1-a266-f6eebc75615d
f2aec520-7f3c-4f86-ae2b-de844d4fea12Checking182330637d21-cbac-4f09-9d24-a4a14baa1c10
f46b26be-7511-4d96-8904-4b8daa6a48d6Checking7583.468010684d-2ffa-41c9-a4a8-562d1e7323e0
f0d5a2c2-1830-4663-a184-b70e9464d90fChecking17313.72fc6828e0-4d14-4f0d-9401-6da0a5fe3aa7
95097ccb-1249-4188-9f84-28f2e56b8627Checking3714.24e9ee3828-3ffc-491f-ba34-c09be0130e82
8212c8f8-aac4-4435-ab7b-0933359264fdChecking1820.283ab94367-8b4d-4bae-8c05-af28c79347f1
c5035f6e-1295-4ab6-a2c9-bb724c96dd50Checking8513.7125e783ec-dc3f-4684-8102-40bce850ce4b
1a82f404-f1da-42ce-823f-7159f63f7b94Checking527.9dbd06d4d-2759-47b4-94be-dce843c551f2
e05105e6-9536-4ef2-ac81-5d6149fc67ebChecking18884.239cc669f7-6d89-4dd2-a194-3bc89511d7c8
8e57ac62-45b6-4794-b5f9-ce1c96c74b2eChecking9285.877f56f9b2-7146-44cc-ab73-3de1113378c5
10 of 3,000 rows · 4 columns

Data dictionary

Data dictionary for the Accounts table
columntypedescriptionexamplenull %
account_iduuidUnique primary identifier for the bank account.unique6c48e9de-46ab-4c4c-b1f9-e52c283ace6d0%
account_typestringCategory of bank account held by the customer.Checking0%
balancedecimalCurrent balance of the account in USD, allowing negative values.2570.530%
customer_iduuidForeign key linking to the customers table.7a9c445f-9d10-43b1-a266-f6eebc75615d0%

Transactions transactions · fact table · 37,366 rows

Records of 37,366 financial transactions.

Preview

First 1 of 37,366 rows of the Transactions table
transaction_iduuidtransaction_datedatetypestringamountdecimalaccount_iduuid
02fd1770-d480-4522-b50e-556d53bf79b22023-05-09Deposit83.07c5035f6e-1295-4ab6-a2c9-bb724c96dd50
1 of 37,366 rows · 5 columns

Data dictionary

Data dictionary for the Transactions table
columntypedescriptionexamplenull %
transaction_iduuidUnique identifier for the financial transaction.9fdd2f49-b9e0-4236-ba77-2ec838276b6b0%
transaction_datedateThe date on which the transaction was posted.2023-10-260%
typestringThe classification of the financial transaction.Deposit0%
amountdecimalThe monetary value of the transaction in USD.114.320%
account_iduuidForeign key linking to the accounts table.2c16adfc-0c03-4a50-8430-d4cee785f2b90%

How the tables join

  • accounts.customer_id references customers.customer_idmany to one: each Accounts row points to one Customers row
  • transactions.account_id references accounts.account_idmany to one: each Transactions row points to one Accounts row

Questions to answer with it

  1. Write a SQL query to find the total balance for each customer, joining the accounts and customers tables.

    Use a SUM aggregate function on the balance column and group by customer.

    tables: accounts, customers

  2. Write a SQL query to list all transactions for a specific account (e.g., account_id = '6c48e9de-46ab-4c4c-b1f9-e52c283ace6d') within a date range (e.g., '2023-01-01' to '2023-12-31').

    Use a WHERE clause with conditions for account_id and transaction_date.

    tables: transactions

  3. Write a SQL query to identify customers who have more than one account type, using a GROUP BY and HAVING clause.

    Group by customer_id and count distinct account_types, then filter with HAVING.

    tables: accounts, customers

  4. Calculate the average transaction amount for each transaction type (Deposit, Withdrawal, etc.) using SQL.

    Use the AVG aggregate function and group by the transaction type.

    tables: transactions

Starter SQL

run against this data before publishing

Table names match the SQLite file and the SQL script.

Total Balance Per Customer

sql
SELECT c.customer_id, c.first_name, c.last_name, SUM(a.balance) AS total_balance
FROM customers c
JOIN accounts a ON c.customer_id = a.customer_id
GROUP BY c.customer_id, c.first_name, c.last_name
ORDER BY total_balance DESC
LIMIT 20;

Transactions for a Specific Account

sql
SELECT transaction_id, transaction_date, type, amount
FROM transactions
WHERE account_id = '6c48e9de-46ab-4c4c-b1f9-e52c283ace6d'
AND transaction_date BETWEEN '2023-01-01' AND '2023-12-31'
ORDER BY transaction_date
LIMIT 20;

Customers with Multiple Account Types

sql
SELECT c.customer_id, c.first_name, c.last_name, COUNT(DISTINCT a.account_type) AS num_account_types
FROM customers c
JOIN accounts a ON c.customer_id = a.customer_id
GROUP BY c.customer_id, c.first_name, c.last_name
HAVING COUNT(DISTINCT a.account_type) > 1
LIMIT 20;

Average Transaction Amount by Type

sql
SELECT type, AVG(amount) AS average_amount
FROM transactions
GROUP BY type
LIMIT 20;

Recent Transactions with Account Type (Window Function)

sql
SELECT
    t.transaction_id,
    t.transaction_date,
    t.amount,
    a.account_type,
    ROW_NUMBER() OVER (PARTITION BY t.account_id ORDER BY t.transaction_date DESC) as rn
FROM transactions t
JOIN accounts a ON t.account_id = a.account_id
WHERE t.transaction_date BETWEEN '2023-01-01' AND '2023-12-31'
LIMIT 20;

Load it with pandas

python
import pandas as pd

# Unzip the CSV download first: one file per table
customers = pd.read_csv("customers.csv")
accounts = pd.read_csv("accounts.csv")
transactions = pd.read_csv("transactions.csv")

# Join accounts to customers
df = accounts.merge(customers, left_on="customer_id", right_on="customer_id", how="left", suffixes=("", "_customers"))
print(df.groupby("city").size().sort_values(ascending=False))

Using it in your tool

SQL
The SQLite database contains 3 tables: customers, accounts, and transactions. Primary keys are customer_id (customers), account_id (accounts), and transaction_id (transactions). Foreign key relationships are accounts.customer_id -> customers.customer_id and transactions.account_id -> accounts.account_id.

Formats available

  • CSV (zip)One CSV file per table, zipped
  • Excel workbookOne worksheet per table
  • SQLite databaseA ready-to-query database file with every table
  • Parquet (zip)One Parquet file per table, zipped
  • SQL scriptCREATE TABLE with primary and foreign keys, then INSERTs
  • CSVA single CSV file
  • JSONA single JSON file

How this data was generated

Synthetic data. Every row was generated: no real people, customers or companies are in this dataset.

Synthetic data generated by GoMask DataFactory from a relational blueprint: keys, links and rules are enforced in code, text columns are filled by a language model. No real people, companies or transactions.

  • Data was generated using GoMask DataFactory.
  • Customer data is based on US cities.
  • Transaction amounts and balances are within realistic ranges.
  • Checked by an automated quality gate: unique keys, no orphan foreign keys, required columns filled, declared rules and date ranges (realism score 92).

Limitations

  • The dataset is synthetic and does not represent real-world individuals or events.
  • Geographic data is limited to US cities.
  • Does not include details on loan interest rates or credit card specific features.
  • Distributions and correlations are modelled, not measured from real records.

Part of these collections

15 SQL practice questions for the Banking Dataset for SQL Practice

Written for this data and checked against it: 12 SQL and 3 Power BI exercises from beginner to advanced. Try the first three free; the practice kit has all 15, a starter .sql file and an answer key with every expected result.

  1. 01BeginnerFreeSELECT · WHERE · ORDER BY

    Customers in Chicago

    Return first_name, last_name and customer_id for every customer whose city is 'Chicago'. Sort the results by last_name, then first_name, then customer_id.

    Tables: customers · your result: 3 columns, 92 rows
  2. 02BeginnerFreeORDER BY · LIMIT

    Top 10 account balances

    Return account_id, account_type and balance for the 10 accounts with the highest balance. Sort by balance descending, then by account_id ascending.

    Tables: accounts · your result: 3 columns, 10 rows
  3. 03BeginnerFreeGROUP BY · COUNT · AVG

    Accounts per account type

    Return account_type, the number of accounts as account_count, and the average balance rounded to 2 decimals as avg_balance. Sort the results by account_type.

    Tables: accounts · your result: 3 columns, 4 rows
  1. 04Large withdrawals in 2023Beginner
  2. 05Total balance by account type visualPower BI
  3. 06Transaction volume by customer cityIntermediate
  4. 07Customers without accountsIntermediate
  5. 08Customers with high total balanceIntermediate
  6. 09Transaction size bandsIntermediate
  7. 10Monthly deposits trend visualPower BI
  8. 11Rank accounts by spending within typeAdvanced
  9. 12Monthly change in transaction totalAdvanced
  10. 13Running total of deposits in 2022Advanced
  11. 14Share of transaction amount by typeAdvanced
  12. 15Anomalous transactions vs account averagePower BI

Get the practice kit: the full dataset, all 15 exercises, a starter .sql and the answer key. One-time $3.99.

Get the practice kit · $3.99

blueprint · banking-dataset-for-sql

Scale this dataset

Same tables. As many rows as you need.

Open the blueprint behind these 3 tables in Data Factory: keep the relationships, change a column, and generate it at the size you need.

  • 200,000 rows
  • 1,000,000 rows
Scale this dataset in Data Factory
Tables
customers, accounts, transactions
Licence
yours to use, including commercially
API slug
banking-dataset-for-sql

What should your data show?

Preview 20 rows free
No signup. No card.