If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Help with simple banking database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-31-11, 19:08
xp_vista007 xp_vista007 is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Help with simple banking database

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
Reply With Quote
  #2 (permalink)  
Old 12-31-11, 20:51
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by xp_vista007 View Post
So i need defining primary keys and foreign keys, can anyone help me with this ?
Thanks
yes, there are several of us who can help

however, we won't do homework assignments

so you have to try, and then ask a question if you're not sure
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-01-12, 09:04
xp_vista007 xp_vista007 is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
I created those tables, but i think i should relate table Client with another table , what would u suggest .


create table Branch (
BranchID int,
BranchCity varchar(30),
Primary key (BranchID)
)

create table Account (
AccountID int,
BranchID int,
AccountNr varchar(20),
Accounttype varchar(15),
Balance int,

Primary key(AccountID),
Foreign key(BranchID) references Branch(BranchID)
)

create table Client(
ClientID int,
ClientName varchar(30),
ClientSurname varchar(30),
ClientTown varchar(20),
primary key (ClientID)
)

create table transaction(
TransID int,
TransType varchar(2),
TransAmount int,
AccountID int,
primary key (TransID),
foreign key (AccountID) references account (AccountID)
)

Last edited by xp_vista007; 01-01-12 at 09:22.
Reply With Quote
  #4 (permalink)  
Old 01-01-12, 09:15
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
Quote:
Originally Posted by xp_vista007 View Post
I created those tables, but i think i should relate table Client with another table , what would u suggest .
if you think that table client should relate to 'something else', then what do you think that relationship is
what do you think associated a client with a bank

...work out what relationships you need before committing to table design

consider using a modelling tool such as SQL power Architect or MySQL's own Workbench

Business Intelligence, Data Warehouse & Data Migration Consulting | SQL Power Consulting
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 01-01-12, 09:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by xp_vista007 View Post
I created those tables, but i think i should relate table Client with another table , what would u suggest .
yes, i think that would be a great idea

let's see...
client related to branch?
client related to account?
client related to transcation?

pick one and discuss why you think client should relate to that entity
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On