Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Posts
    3

    Unanswered: Adding records to multiple tables

    I have several tables and one "Master" table all linked by an ID field which is the primary key for each table. How can I automatically update the "master" table with any addition, deletion or change I make in the non-master tables? Thanks in advance

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Sounds like your table structures are a wee bit wrong...
    Are these records lookups?
    Example:
    If you wanted to store country against and employees record (the master table in this case is employees) then instead of each employee record containing the words "United Kingdom" or "United States of America" etc etc...
    Then you would create a joining lookup table to hold this information (normalisation!).
    Your tables would then be something like:

    Employees(EmployeeNum, Surname, Forename, CountryID)
    Country(CountryID, CountryName)
    Where the join between the tables is CountryID.

    So instead of our employee table looking like this:
    Employees
    01 | Smith | John | United Kingdom
    02 | Smith | Dave | United Kingdom
    03 | Smith | Paul | United States of America
    04 | Smith | 1337 | United States of America
    ...

    To a normalised form of:
    Employees
    01 | Smith | John | 01
    02 | Smith | Dave | 01
    03 | Smith | Paul | 02
    04 | Smith | 1337 | 02
    ...

    Country
    01 | United Kingdom
    02 | United States of America
    ...

    Now for the answer to your question
    If you use lookup tables - to make a change - for example you made a spelling mistake in United Kingdom - instead of updating every record in the employee table, you just make the change in the Country table (our new lookup table).

    HTH (instead of confuses)
    George
    Home | Blog

Posting Permissions

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