Forum Discussion

Arcturus's avatar
Arcturus
Helper I
8 years ago
Solved

Understanding Relationships

Hello everyone,   I am having a hard time understanding how relationship work, what they do, etc     My situation is as follows: Say I have a query containing sales data at the geographic level,...
  • Chris99's avatar
    Chris99
    8 years ago

    Hi Arcturus

     

    My first thought would be to go for

    • Sales table that contains a unique id, a sales date, an amount, a product id, and a location id,
    • Product table that contains a product id and a description
    • Location table that contains a location id and a description

    Then create the following relations

    • Sales product id to Product product id (Many to one)
    • Sales location id to Location location id (Many to one)

    That should get you going, and then later you can flesh it out, maybe by adding a region to your Location table, or adding a new Salesperson table and a salesperson id to the Sales table.

     

    Hope this helps,

     

    Chris

  • Chris99's avatar
    Chris99
    8 years ago

    If you want a date table then you should have a single row per date. The error suggests that the date table has duplicate dates.