solarissf solarissf - 1 year ago 106
SQL Question

SQL tables design layout

I'm trying to design my database with very basic tables and I am confused on the CORRECT way to do it.

I've attached a picture of the main info, and I'm not quite sure how to link them. Meaning what should be a foreign key, or should some of these tables include of LIST<> of the other tables.


updated tables

Answer Source

As per your requirements, You are right about the associative table

  1. Client can have multiple accounts And Accounts can have multiple clients
    Then, Many (Client) to Many (Account)
    So, Create an associate table to break the many to many relationship first. Then join it that way
  2. Account can have only one Manager
    Which means One(Manager) to Many(Accounts)
    So, add an attribute called ManagerID in Accounts
  3. Account can have many traedetail
    Which means One(Accounts) to Many(TradeDetails)
    So, add an attribute called AccountID in TradeDetails
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download