Surrogate keys in dimension and fact table

View previous topic View next topic Go down

Surrogate keys in dimension and fact table

Post  in.bobj on Tue Aug 23, 2011 7:20 am

Hell Gurus,

I am very much confused about this part of dimensional modelling.
If we use surrogate keys in our dimensional model, how we link the same with the fact table.
Because the surrogate key will be a sequence number generated with dimension table only.


For eg.
If I have created a dimension table customer with CUSTOMER_ID(natural key), Customer name.
and fact table ABC with columns as CUSTOMER_ID(foreign key) and REVENUE.
NOW if I create a surrogate key in dimension customer i.e. SID...How I will be able to link with fact table.

Can somebody help me understand.
I know the use of surrogate key in Slow changing dimension but not able to understand its link with fact table.


Thanks
in.bobj

in.bobj

Posts : 2
Join date : 2011-08-23

View user profile

Back to top Go down

Re: Surrogate keys in dimension and fact table

Post  ngalemmo on Tue Aug 23, 2011 10:44 am

You store the dimension's surrogate key as the FK in the fact table, not the customer ID.

To get the dimension's key, use the customer ID to locate the dimension row and retrive the key value from the row.
avatar
ngalemmo

Posts : 3000
Join date : 2009-05-15
Location : Los Angeles

View user profile http://aginity.com

Back to top Go down

Thank you

Post  in.bobj on Wed Aug 24, 2011 1:39 am

Thank You ngalemmo.

It clears a lot of doubts for me now.

in.bobj

Posts : 2
Join date : 2011-08-23

View user profile

Back to top Go down

Re: Surrogate keys in dimension and fact table

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum