GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Data Warehousing  >  Basics
Go To First  |  Previous Question  |  Next Question 
 Basics  |  Question 48 of 111    Print  
What is surrogate key ? where we use it expalin with examples
don't know


  
Total Answers and Comments: 19 Last Update: May 16, 2008     Asked by: Minish Cherian 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
October 20, 2005 16:22:33   #1  
mallakishore Member Since: October 2005   Contribution: 7    

RE: What is surrogate key ? where we use it expalin wi...
Surrogate key is the primary key for the Dimensional table.
 
Is this answer useful? Yes | No
October 30, 2005 23:17:08   #2  
rvishnudas Member Since: October 2005   Contribution: 2    

RE: What is surrogate key ? where we use it expalin wi...
 surrogate key is a substitution for the natural primary key.

It is just a unique identifier or number for each row that can be used for the primary key to the table. The only requirement for a surrogate primary key is that it is unique for each row in the table.

Data warehouses typically use a surrogate, (also known as artificial or identity key), key for the dimension tables primary keys. They can use Infa sequence generator, or Oracle sequence, or SQL Server Identity values for the surrogate key.

It is useful because the natural primary key (i.e. Customer Number in Customer table) can change and this makes updates more difficult.

Some tables have columns such as AIRPORT_NAME or CITY_NAME which are stated as the primary keys (according to the business users) but ,not only can these change, indexing on a numerical value is probably better and you could consider creating a surrogate key called, say, AIRPORT_ID. This would be internal to the system and as far as the client is concerned you may display only the AIRPORT_NAME.

2. Adapted from response by Vincent on Thursday, March 13, 2003

Another benefit you can get from surrogate keys (SID) is :

Tracking the SCD - Slowly Changing Dimension.

Let me give you a simple, classical example:

On the 1st of January 2002, Employee 'E1' belongs to Business Unit 'BU1' (that's what would be in your Employee Dimension). This employee has a turnover allocated to him on the Business Unit 'BU1' But on the 2nd of June the Employee 'E1' is muted from Business Unit 'BU1' to Business Unit 'BU2.' All the new turnover have to belong to the new Business Unit 'BU2' but the old one should Belong to the Business Unit 'BU1.'

If you used the natural business key 'E1' for your employee within your datawarehouse everything would be allocated to Business Unit 'BU2' even what actualy belongs to 'BU1.'

If you use surrogate keys, you could create on the 2nd of June a new record for the Employee 'E1' in your Employee Dimension with a new surrogate key.

This way, in your fact table, you have your old data (before 2nd of June) with the SID of the Employee 'E1' + 'BU1.' All new data (after 2nd of June) would take the SID of the employee 'E1' + 'BU2.'

You could consider Slowly Changing Dimension as an enlargement of your natural key: natural key of the Employee was Employee Code 'E1' but for you it becomes
Employee Code + Business Unit - 'E1' + 'BU1' or 'E1' + 'BU2.' But the difference with the natural key enlargement process, is that you might not have all part of your new key within your fact table, so you might not be able to do the join on the new enlarge key -> so you need another id.

 
Is this answer useful? Yes | No
October 31, 2005 07:02:58   #3  
venkatkalpana Member Since: October 2005   Contribution: 6    

RE: What is surrogate key ? where we use it expalin wi...
Dear User,When creating a dimension table in a data warehouse, we generally create the tables witha system generated key to unqiuely identify a row in the dimension. This key is also known as a surrogate key. The surrogate key is used as the primary key in the dimension table. The surrogate key will also be placed in the fact table and a foreign key will be defined between the two tables. When you ultimately join the data it will join just as any other join within the database. should you need any further assistance pls revert to this mail id venkatdba2000@yahoo.com or venkata.veluri@gmail.comRegardsVen (Venkat)
 
Is this answer useful? Yes | No
November 10, 2005 22:36:34   #4  
reddy.amarnadh@gmail.com Member Since: September 2005   Contribution: 1    

RE: What is surrogate key ? where we use it expalin wi...
A surrogate key to a datawarehouse is what a primary key is for an OLTP source. It is used to uniquely identify a record in dimension tables. it provides the solution for the critical col., problem.amar
 
Is this answer useful? Yes | No
November 28, 2005 00:40:06   #5  
girish        

RE: What is surrogate key ? where we use it expalin wi...

surrogate key is system generated artifical primary key values

eg: any candidate key can be considered as surrogate key.


 
Is this answer useful? Yes | No
December 02, 2005 10:41:29   #6  
saravanan        

RE: What is surrogate key ?

Surrogate key is a unique identification key, it is like an artificial or  alternative key to production key, bz the production key may be alphanumeric or composite key but the surrogate key is always single numeric key. 

assume the production key is an alphanumeric field. if u create an index for this fields it will occupy more space, so it is not advicable to join/index, bz generally all the  datawarehousing fact table are having historical data.   these factable are linked with somany dimension table. if it's a numerical fields the performance is high 


 
Is this answer useful? Yes | No
January 03, 2006 03:38:36   #7  
sithusithu Member Since: December 2005   Contribution: 161    

RE: What is surrogate key ? where we use it expalin wi...

surrogate key in a data warehouse is more than just a substitute for a natural key. In a data warehouse, a surrogate key is a necessary generalization of the natural production key and is one of the basic elements of data warehouse design

Sithu


 
Is this answer useful? Yes | No
March 09, 2006 00:29:52   #8  
ravi kumar guturi        

RE: What is surrogate key ? where we use it expalin wi...

Surogate key is a systemgenerated key, It is mainly used for criticalum in dwh,Here criticalum means nothing but it is a column which when we updated  in the them most dwh in to oltp systmes


 
Is this answer useful? Yes | No
March 17, 2006 07:01:16   #9  
sunil        

RE: What is surrogate key ? where we use it expalin wi...
surrogete keys r tht which join dimension tables and fact table
 
Is this answer useful? Yes | No
March 29, 2006 01:02:01   #10  
Giridhar        

RE: What is surrogate key ? where we use it expalin wi...

          

       Surrogate Key is the solution for critical column problems.

               For example the customur purcshases different items in differnt locations,for this situation we have to maintain historical data.

                By using surrogate key we can introduce the row in the datawarehouse to maintain historical data.


 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape