# Help with simple banking database

**URL:** <https://forums.percona.com/t/help-with-simple-banking-database/1730>\
**Category:** Other MySQL® Questions\
**Created:** [December 31, 2011, 6:37pm UTC](https://forums.percona.com/t/help-with-simple-banking-database/1730 "2011-12-31T18:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xp\_vista007](https://avatars.discourse-cdn.com/v4/letter/x/977dab/32.png) [@xp\_vista007](https://forums.percona.com/u/xp_vista007)\
**Post date:** [December 31, 2011, 6:37pm UTC](https://forums.percona.com/t/help-with-simple-banking-database/1730/1 "2011-12-31T18:37:02Z")

</div>

I have to create a simple bank database using MySQL, so i have to create tables and relationships between them (normalization).

I have created those tables :

Branch (BranchID, BranchPlace)

Account (AccountID, AccountNumber, AccountType, Balance)

Client (ClientID, ClientName, ClientSurname, ClientCity)

Transaction (TransactionID, TransactionType, Amount)

So i need defining primary keys and foreign keys, can anyone help me with this ?  
Thanks

---

<div class="post-metadata">

**Author:** ![scott.nemes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/scott.nemes/32/5_2.png) [@scott.nemes](https://forums.percona.com/u/scott.nemes)\
**Post date:** [January 2, 2012, 3:59pm UTC](https://forums.percona.com/t/help-with-simple-banking-database/1730/2 "2012-01-02T15:59:16Z")

</div>

You will first need to better understand the business case to determine what relationships need to exist, but my basic suggestions would be:

1. Add ClientID to the ‘Account’ table with the foreign key constraint: Account.ClientID =\> Client.ClientID
2. Add AccountID and BranchID to the ‘Transaction’ table with the foreign key constraints: Transaction.AccountID =\> Account.AccountID, Transaction.BranchID =\> Branch.BranchID

With those changes you will know the applicable information for each transaction (account number, client, and branch).

Hope that helps!  
Scott
