creating fact table and surrogate keys

  • Hello,

    Problem 1:

    I have a database that contains industrial data. Now there are 2 tables

    1st: Aim_chemistry : that contains act amount of elements that should be used like carbon,silicon etc,.

    2nd : Act_chemeistry : that contains actually used amounts of the same elements.

    Should I make both of these as individual dimention? if not what can i do?

    Problem 2:

    There are few table without primary keys. How do i creat a surrogate key(System generated keys) for existing tables which already have data?

    Kindly help.

  • veena.jokhakar (1/18/2011)


    Problem 1:

    I have a database that contains industrial data. Now there are 2 tables

    1st: Aim_chemistry : that contains act amount of elements that should be used like carbon,silicon etc,.

    2nd : Act_chemeistry : that contains actually used amounts of the same elements.

    Should I make both of these as individual dimention? if not what can i do?

    Problem 2:

    There are few table without primary keys. How do i creat a surrogate key(System generated keys) for existing tables which already have data?

    1 - Too little info to tell.

    2 - Adding the column to the target table is not a problem... how are you planning to populate related columns on other already populated tables?

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • veena.jokhakar (1/18/2011)


    Hello,

    Problem 1:

    I have a database that contains industrial data. Now there are 2 tables

    1st: Aim_chemistry : that contains act amount of elements that should be used like carbon,silicon etc,.

    2nd : Act_chemeistry : that contains actually used amounts of the same elements.

    Should I make both of these as individual dimention? if not what can i do?

    Problem 2:

    There are few table without primary keys. How do i creat a surrogate key(System generated keys) for existing tables which already have data?

    Problem 1 advice: I would set Aim_Chemistry as a dimension and act_chemistry as a fact table. aim_chemistry sounds like a table that will be set up for reference while act_chemistry sounds like a transactional table that will be constantly changing as item used amounts are added or changed. Fact tables usually are comprised of just keys and measurable fields so I would have the aim_chemistry key ID as one of the fields in your act_chemistry table. Without more information on table schemas or sample data, I can't really say what would work best for you on this.

    Problem 2 advice: Surrogate keys are usually identity fields on a dimension table where each row in the table has a unique ID. Since there are no primary keys already defined for some tables, I would try to find what combination of fields for each table creates a unique ID. For example, if you had a table that contained Territories and sales agents and sales agents could map to more than one territory, then your primary key would have to be on the sales agent ID and Territory ID. This composite key would make each row unique.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply