INTRODUCTION There are some instances when a  primary key doesn’t exist in the  real world or when the existingnatural key...
SURROGATE KEY:Is a primary key created bythe database designer tosimplify the identification ofentity instances.
ADVANTAGESince it has no intrinsic meaning,values for it can be generated bythe DBMS to ensure that uniquevalues are alway...
TABLE 5.4  DATE       TIME_START   TIME_END   ROOM      EVENT_NAME      PARTY_OF6/17/2010     11:00AM      2:00PM    Allur...
 Given the data shown in table 5.4 you would          model the EVENT entity as:EVENT(DATE, TIME_START, TIME_END,ROOM    ...
DATE TIME_ TIME        ROOM      EVENT_     PART     START _EN                    NAME      Y_OF   What primary key would ...
DAT TIME_      TIME_   ROO      EVENT_     PART E  START       END     M        NAME      Y_OF        Assume you select th...
DATE TIME_ TIME        ROOM     EVENT      PART     START _EN                  _NAME      Y_OF   Given the business rules,...
Surrogate primary keys are accepted   practice in todays complex data            environments.
They are especially helpful when there  is no natural key, when the selected candidate key has embedded semantic     cont...
However , there is a trade-off; if you use  a surrogate key, you must ensure that     the candidate key of the entity in ...
PREPARED BY:   ROSELYN P. CEAALLYSA JANE CATALLA      BLIS -III
Catalla & cea
Catalla & cea
Catalla & cea
Upcoming SlideShare
Loading in …5
×

Catalla & cea

343 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
343
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Catalla & cea

  1. 1. INTRODUCTION There are some instances when a primary key doesn’t exist in the real world or when the existingnatural key might not be a suitable primary key.
  2. 2. SURROGATE KEY:Is a primary key created bythe database designer tosimplify the identification ofentity instances.
  3. 3. ADVANTAGESince it has no intrinsic meaning,values for it can be generated bythe DBMS to ensure that uniquevalues are always provided.
  4. 4. TABLE 5.4 DATE TIME_START TIME_END ROOM EVENT_NAME PARTY_OF6/17/2010 11:00AM 2:00PM Allure Burton 60 Wedding6/17/2010 11:00AM 2:00PM Bonanza Adams Office 126/17/2010 3:00PM 5:30PM Allure Smith Family 156/17/2010 3:30PM 5:30PM Bonanza Adam’s Office 126/18/2010 1:00PM 3:00PM Bonanza Boy Scouts 336/18/2010 11:00AM 2:00PM Allure March of 25 Dines6/18/2010 11:00AM 12:30PM Bonanza Smith Family 12
  5. 5.  Given the data shown in table 5.4 you would model the EVENT entity as:EVENT(DATE, TIME_START, TIME_END,ROOM ,EVENT_NAME,PARTY_OF)
  6. 6. DATE TIME_ TIME ROOM EVENT_ PART START _EN NAME Y_OF What primary key would you D suggest? In this case , there is no6/17 11:00 2:00 Allure Burton 60 simple natural key that could be /10 AM PM Wedding used as a primary key in the6/17/ 11:00 2:00 Bonanza Adams 12 model. Based on the primary key 10 AM PM Office concepts you learned about in previous chapters, you might6/17/ 3:00 5:30 Allure Smith 15 suggest one of these options. 10 PM PM Family6/17/ 3:30 5:30 Bonanza Adam’s 12 10 PM PM Office (DATE, TIME_START, ROOM)6/18/ 1:00 3:00 Bonanza Boy 33 Or 10 PM PM Scouts (DATE, TIME_END, ROOM)6/18/ 11:00 2:00 Allure March of 25 10 AM PM Dines6/18/ 11:00 12:3 Bonanza Smith 12 10 AM 0PM Family
  7. 7. DAT TIME_ TIME_ ROO EVENT_ PART E START END M NAME Y_OF Assume you select the composite primary key (DATE, TIME_START,ROOM) for the6/17 11:00 2:00P Allure Burton 60 EVENT entity. Next ,you/10 AM M Wedding determine that one EVENT may6/17 11:00 2:00P Bonan Adams 12 use many RESOURCES such as/10 AM M za Office tables, projectors, pc and stands, and that the same6/17 3:00 5:30P Allure Smith 15 RESOURCE may be use for/10 PM M Family many EVENTS. The RESOURCE entity would be represented by6/17 3:30 5:30P Bonan Adam’s 12 the ff. attributes:/10 PM M za Office6/18 1:00 3:00P Bonan Boy 33 RESOURCE (RSC_ID,/10 PM M za Scouts RSC_DESCRIPTION,RSC_T6/18 11:00 2:00P Allure March of 25 YPE, RSC_QTY,RSC_PRICE)/10 AM M Dines6/18 11:00 12:30 Bonan Smith 12/10 AM PM za Family
  8. 8. DATE TIME_ TIME ROOM EVENT PART START _EN _NAME Y_OF Given the business rules, the M:N D relationship between RESOURCE and EVENT would be represented6/17 11:00 2:00P Allure Burton 60 via the EVNTRSC composite entity/10 AM M Wedding with a composite primary key as6/17 11:00 2:00P Bonan Adams 12 follows:/10 AM M za Office EVNTRSC (DATE, TIME _START,6/17 3:00 5:30P Allure Smith 15 ROOM, RSC_ID, QTY _USED/10 PM M Family You now have a lengthy four-6/17 3:30 5:30P Bonan Adam’s 12 attribute composite primary key./10 PM M za Office What would happen if the EVNTRSC entity’s primary key were inherited by another6/18 1:00 3:00P Bonan Boy 33 existence dependent entity? At/10 PM M za Scouts this point, you can see that the6/18 11:00 2:00P Allure March of 25 composite primary key could/10 AM M Dines make the implementation of the database and program coding6/18 11:00 12:30 Bonan Smith 12 unnecessarily complex./10 AM PM za Family
  9. 9. Surrogate primary keys are accepted practice in todays complex data environments.
  10. 10. They are especially helpful when there is no natural key, when the selected candidate key has embedded semantic contents or when the selected candidate key is too long or cumbersome.
  11. 11. However , there is a trade-off; if you use a surrogate key, you must ensure that the candidate key of the entity in question performs properly through the use of “unique index” and “not null” constraints.
  12. 12. PREPARED BY: ROSELYN P. CEAALLYSA JANE CATALLA BLIS -III

×