By: Yurii
Create a database to manage personal finances, including tracking income and expenses, managing budgets, monitoring account balances, and generating financial reports.
- Users
- Accounts
- Transaction Categories
- Transactions
- Integration with external APIs
- Automatic transaction classification
- Register and log in
- Manage accounts and categories
- Manage transactions
- View balances and reports
- Set and track budgets
- Integrate with banking APIs
- Automatically classify transactions
- Attributes:
- UserID: INT, Primary Key, Auto Increment
- FirstName: VARCHAR(255), Not Null
- LastName: VARCHAR(255), Not Null
- Email: VARCHAR(255), Unique, Not Null
- Password: VARCHAR(255), Not Null
- Attributes:
- AccountID: INT, Primary Key, Auto Increment
- UserID: INT, Foreign Key (references Users(UserID)), Not Null
- AccountName: VARCHAR(255), Not Null
- Balance: DECIMAL(10, 2), Not Null
- Attributes:
- CategoryID: INT, Primary Key, Auto Increment
- UserID: INT, Foreign Key (references Users(UserID)), Not Null
- CategoryName: VARCHAR(255), Not Null
- Attributes:
- TransactionID: INT, Primary Key, Auto Increment
- UserID: INT, Foreign Key (references Users(UserID)), Not Null
- AccountID: INT, Foreign Key (references Accounts(AccountID)), Not Null
- CategoryID: INT, Foreign Key (references Categories(CategoryID))
- Amount: DECIMAL(10, 2), Not Null
- Date: DATE, Not Null
- Description: VARCHAR(255)
- Users - Accounts: One-to-Many (One user can have multiple accounts)
- Users - Categories: One-to-Many (One user can create multiple categories)
- Users - Transactions: One-to-Many (One user can have multiple transactions)
- Accounts - Transactions: One-to-Many (One account can have multiple transactions)
- Categories - Transactions: One-to-Many (One category can be associated with multiple transactions)
- Indexes on UserID, AccountID, CategoryID for faster queries
- Views for income and expense reports
- No integration with external APIs
- Limited analytics capabilities
erDiagram
USERS {
INT UserID PK "Auto Increment"
VARCHAR FirstName "255 Not Null"
VARCHAR LastName "255 Not Null"
VARCHAR Email "255 Unique Not Null"
VARCHAR Password "255 Not Null"
}
ACCOUNTS {
INT AccountID PK "Auto Increment"
INT UserID FK "references Users(UserID) Not Null"
VARCHAR AccountName "255 Not Null"
DECIMAL Balance "10,2 Not Null"
}
CATEGORIES {
INT CategoryID PK "Auto Increment"
INT UserID FK "references Users(UserID) Not Null"
VARCHAR CategoryName "255 Not Null"
}
TRANSACTIONS {
INT TransactionID PK "Auto Increment"
INT UserID FK "references Users(UserID) Not Null"
INT AccountID FK "references Accounts(AccountID) Not Null"
INT CategoryID FK "references Categories(CategoryID)"
DECIMAL Amount "10,2 Not Null"
DATE Date "Not Null"
VARCHAR Description "255"
}
USERS ||--o{ ACCOUNTS: "has"
USERS ||--o{ CATEGORIES: "creates"
USERS ||--o{ TRANSACTIONS: "makes"
ACCOUNTS ||--o{ TRANSACTIONS: "includes"
CATEGORIES ||--o{ TRANSACTIONS: "associated with"
my exercise week 3: