Deke1604 / LC1-Assessment-DEKE

MIT License
0 stars 1 forks source link

Database Schema for a Fintech Application #7

Open Deke1604 opened 1 year ago

Deke1604 commented 1 year ago

The database for the fintech application will have four tables: users, accounts, transactions, and budgets. The "users" table will have a column for the username and a column for the password. The "accounts" table will have columns for the account ID, username, and balance. The "transactions" table will have columns for the transaction ID, account ID, amount, and timestamp. The "budgets" table will have columns for the budget ID, name, and balance. The "users" table will have a one-to-many relationship with the "accounts" table. This means that a user can have many accounts, but an account can only have one user. The "transactions" table will have a many-to-many relationship with the "accounts" table. This means that a transaction can be associated with many accounts, and an account can have many transactions. The "budgets" table will have a one-to-many relationship with the "users" table. The "username" column in the "users" table will be a unique key, meaning that no two users can have the same username. The "account ID" column in the "transactions" table will be a foreign key, meaning that it must match a value in the "account ID" column of the "accounts" table. The "budget ID" column in the "budgets" table will also be a foreign key, meaning that it must match a value in the "budget ID" column of the "users" table. The "username" column in the "users" table will have an index, as well as the "account ID" and "transaction ID" columns in the "transactions" table. The "budget ID" column in the "budgets" table will also have an index. These indexes will help to improve the performance of the database by making it easier to search for specific records.

Let's start with the database schema for the "users" table. The "users" table will have the following columns:

Next, let's move on to the database schema for the "accounts" table. The "accounts" table will have the following columns:

The "transactions" table will have the following columns:

Now, we'll move on to the database schema for the "budgets" table. The "budgets" table will have the following columns:

Now, we can see how all the tables relate to each other. Each "user" will have one or more "accounts". Each "account" will have one or more "transactions". And each "user" will have one or more "budgets".