Finance & Expense Tracker Analysis ๐ฐ
Build a real-world finance analytics project to track income, expenses, savings, budgets, and cash flow using SQL.
๐ฏ Business Objectives
โ Track monthly income and expenses
โ Analyze spending by category
โ Monitor savings trends
โ Compare budget vs actual spending
โ Identify high-expense categories
โ Analyze cash flow
โ Track recurring expenses
โ Generate financial dashboards
๐ Step 1: Create Database
CREATE DATABASE finance_db;
USE finance_db;
๐ Step 2: Create Categories Table
CREATE TABLE categories (
category_id INT PRIMARY KEY,
category_name VARCHAR(50),
transaction_type VARCHAR(20)
);
๐ Step 3: Create Accounts Table
CREATE TABLE accounts (
account_id INT PRIMARY KEY,
account_name VARCHAR(50),
account_type VARCHAR(30),
opening_balance DECIMAL(12,2)
);
๐ Step 4: Create Transactions Table
CREATE TABLE transactions (
transaction_id INT PRIMARY KEY,
account_id INT,
category_id INT,
transaction_date DATE,
amount DECIMAL(12,2),
description VARCHAR(255),
FOREIGN KEY (account_id) REFERENCES accounts(account_id),
FOREIGN KEY (category_id) REFERENCES categories(category_id)
);
๐ Step 5: Insert Sample Categories
INSERT INTO categories VALUES
(1,'Salary','Income'),
(2,'Freelancing','Income'),
(3,'Rent','Expense'),
(4,'Groceries','Expense'),
(5,'Utilities','Expense'),
(6,'Entertainment','Expense'),
(7,'Transport','Expense');
๐ Step 6: Insert Sample Accounts
INSERT INTO accounts VALUES
(101,'Savings Account','Bank',50000),
(102,'Credit Card','Card',0),
(103,'Cash Wallet','Cash',5000);
๐ Step 7: Insert Sample Transactions
INSERT INTO transactions VALUES
(1001,101,1,'2025-01-01',85000,'Monthly Salary'),
(1002,101,3,'2025-01-03',18000,'House Rent'),
(1003,101,4,'2025-01-05',4200,'Supermarket'),
(1004,102,6,'2025-01-08',2500,'Movie & Dinner'),
(1005,103,7,'2025-01-09',800,'Cab Fare'),
(1006,101,5,'2025-01-12',2200,'Electricity Bill'),
(1007,101,2,'2025-01-18',15000,'Freelance Project');
๐ง SQL Concepts You'll Practice
โ DDL & DML
โ Joins
โ Aggregate Functions
โ GROUP BY
โ HAVING
โ CASE WHEN
โ CTEs
โ Window Functions
โ Date Functions
โ Financial Calculations
๐ Business KPIs You Can Build
๐ Total Income
๐ Total Expenses
๐ Net Savings
๐ Savings Rate
๐ Monthly Cash Flow
๐ Income by Source
๐ Expenses by Category
๐ Highest Expense Category
๐ Budget vs Actual Spending
๐ Average Daily Spending
๐ Monthly Spending Trend
๐ Running Account Balance
๐ Recurring Expense Analysis
๐ Weekend vs Weekday Spending
๐ Top 10 Largest Transactions
๐ Account-wise Balance
๐ Income Growth Rate
๐ Expense Growth Rate
๐ Category-wise Contribution
๐ Financial Health Dashboard
๐ฏ This project reflects real-world SQL work performed by Financial Analysts, FP&A teams, FinTech companies, banks, and Business Intelligence professionals to monitor financial performance and support better decision-making.
๐ก Double Tap โค๏ธ For More