Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database of bank accounts

I'm creating a database for a 'bank' and was just unsure as to whether my method of attaching accounts to customers was the most efficient. Here are a few of the enterprise rules:

-there are 2 types of account (current and savings)

-each account has a field for: balance, date of last access

-current accounts have overdraft

-savings accounts have interest_rate

-a customer can have as many accounts as they want

-an account can be 'subscribed' to unlimited people

I'm just not sure if the best method is just to have interest rate and overdraft in the account table to be set to null if it is the wrong account type.

Sorry if this question isn't put very well (I'm breaking my stackoverflow virginity here). Also, here is a link to the ER diagram have created so far: https://drive.google.com/file/d/0BwKmjTsIbwP0SE9Xbk1ycnkyV0E/edit?usp=sharing

Sorry that I couldn't post the image directly on here, it's just because I've got no rep...

Thanks in advance!

like image 203
user3665815 Avatar asked May 22 '14 16:05

user3665815


People also ask

What databases are used by banks?

Answer: MySQL is a popular database for banking systems because it has all the features needed for the project. Large businesses usually choose SQL Server, Oracle, IBM, and other vendors because they have advanced features and (most importantly) commercial support.

Is a bank account a database?

Bank account information is stored in a complex database or set of databases known as a banking core.

What is Bank database?

In database management and information architecture, a data bank or databank is a repository of information on one or more subjects – a database – that is organized in a way that facilitates local or remote information retrieval and is able to process many continual queries over a long period of time.


1 Answers

You take the information that you're given, and you normalize the data into relations. That's why you use a relational database.

So let's start with customers. We'll create a Customer table. Generally, table names are singular.

Customer
--------
Customer ID
Customer name
Customer address
...

As you can see, all of the data in the Customer table is about the customer.

Next, we'll create an Account table.

Account
-------
Account ID
Account Type ID
Account balance
Account interest rate
Account overdraft
Account last access time stamp

All the data in the Account table came from your requirements statement. The interest rate is set to zero for accounts with no interest. The overdraft is set to zero for accounts with no overdraft.

Next, we'll create an Account Type table.

Account Type
------------
Account Type ID
Account Type

The data would be (0, Checking) and (1, Savings). With an Account Type table, you can easily add new account types, like (2, Certificate of Deposit).

Next, even though you don't mention it, we'll create a Transaction table. You'll need this to be able to print monthly statements.

Transaction
-----------
Transaction ID
Transaction time stamp
Transaction amount
Account ID

Ok, we've set up all of the entity type tables for banking. Now, let's set up the relationship tables.

Customer and Account have a many to many relationship. A customer can have many accounts, and an account can have many customers.

So, let's create a Customer Account table.

Customer Account
----------------
Customer ID
Account ID
Customer Account creation time stamp

The primary (clustering) key is (Customer ID, Account ID). You'll also need a unique index on (Account ID, Customer ID)

I believe we're done creating tables.

  • An account has an account type.

  • A customer can have many accounts.

  • An account can have many customers.

  • An account can have many transactions.

  • A transaction is posted to one account.

like image 153
Gilbert Le Blanc Avatar answered Sep 23 '22 05:09

Gilbert Le Blanc