Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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 10:22.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •