Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers A Unique Identifier (UID) is any combination of attributes and/or.

Similar presentations


Presentation on theme: "Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers A Unique Identifier (UID) is any combination of attributes and/or."— Presentation transcript:

1 Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers A Unique Identifier (UID) is any combination of attributes and/or relationships that serve to uniquely identify each occurrence of an entity. A Unique Identifier (UID) is any combination of attributes and/or relationships that serve to uniquely identify each occurrence of an entity. Each entity must have at least one way it can be uniquely identified. If it doesn ’ t, it is not an entity. Each entity must have at least one way it can be uniquely identified. If it doesn ’ t, it is not an entity. THEATRE TICKET #* date of performance #* seat number DEPARTMENT #* number * name * name Each occurrence of DEPARTMENT is uniquely identified by its department number. The UID (primary) is the combination of the two attributes, date of performance and seat number. 3-62

2 Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers Through Relationships An occurrence of an entity can be uniquely identified (usually in combination) by its relationship in a one and only one direction to another entity. An occurrence of an entity can be uniquely identified (usually in combination) by its relationship in a one and only one direction to another entity. The UID bar on the relationship line indicates that the relationship is part of the primary UID. For primary UIDs this must be a mandatory relationship. ACCOUNT BANK #* number * name * name #* number * balance * balance * date opened * date opened * bank location * bank location managed by the manager of The same ACCOUNT numbers exist at different BANKs so the relationship is part of the UID. 3-63

3 Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers Through Multiple Relationships What is the UID for WORK ASSIGNMENT? EMPLOYEE #* id * name * name WORK ASSIGNMENT * date assigned * date assigned * duration * duration * position * position PROJECT #* number * title * title What makes each occurrence of WORK ASSIGNMENT unique? for given the subject of to 3-64

4 Copyright Ó Oracle Corporation, 1998. All rights reserved. Part of what makes WORK ASSIGNMENT unique is its relationships to one and only one EMPLOYEE and to one and only one PROJECT. EMPLOYEE WORK ASSIGNMENT * date assigned * date assigned * duration * duration * position * position PROJECT #* number * title * title The two relationships, ‘to EMPLOYEE’ and ‘for PROJECT’ uniquely identify a WORK ASSIGNMENT. #* id * name * name to the subject of completed via for Could an EMPLOYEE work on the same PROJECT, more than once? Assign Unique Identifiers Through Multiple Relationships (cont) 3-64

5 Copyright Ó Oracle Corporation, 1998. All rights reserved. Determine If an Entity has More Than One Unique Identifier Select one candidate UID to be the primary, and all the others to be secondary UIDs, labeled (#) Select one candidate UID to be the primary, and all the others to be secondary UIDs, labeled (#) Look for whatever naturally identifies the entity. Look for whatever naturally identifies the entity. #* badge number #* badge number (#)* payroll number * first name * first name * last name * last name * date of birth * date of birth EMPLOYEE * badge number * badge number * payroll number * payroll number * first name * first name * last name * last name * date of birth * date of birth Candidate UIDs include the first two and a combination of the employee ’ s first and last name, if it is unique. EMPLOYEE In this example, each occurrence has two different ways it can be uniquely identified, and the EMPLOYEE’s identifier was chosen as the primary. 3-65

6 Copyright Ó Oracle Corporation, 1998. All rights reserved. Consider Creating Unique, Artificial Attributes to Help Identify Each Entity Define an artificial code or identifier when the business does not have natural attribute(s) and/or relationship(s) which uniquely identify each entity. Define an artificial code or identifier when the business does not have natural attribute(s) and/or relationship(s) which uniquely identify each entity. #* identifier * first name * first name * last name * last name * address * address CUSTOMER * first name * first name * last name * last name * address * address What uniquely identifies each occurrence of the CUSTOMER entity? Consider adding the artificial attribute, identifier, to the CUSTOMER entity. CUSTOMER In this example, each occurrence had no way it could be naturally uniquely identified, so the CUSTOMER’s identifier was added as the primary UID. 3-66

7 Copyright Ó Oracle Corporation, 1998. All rights reserved. Search for Attributes and Relationships to Identify Each Entity Evaluate the Attributes What mandatory attributes identify the entity that will be primary UID candidates? What mandatory attributes identify the entity that will be primary UID candidates? Seek out additional natural ways to identify the entity. Seek out additional natural ways to identify the entity. Consider creating artificial attributes. Consider creating artificial attributes. Does an attribute uniquely identify each occurrence of the entity? Does an attribute uniquely identify each occurrence of the entity? What combination of attributes uniquely identify the entity? What combination of attributes uniquely identify the entity? 3-67

8 Copyright Ó Oracle Corporation, 1998. All rights reserved. Consider the Relationships Which of the relationships help identify the entity? Which of the relationships help identify the entity? Are there missing relationships that help identify the entity? Are there missing relationships that help identify the entity? Does the relationship help uniquely identify the entity? In other words, is it an absolutely necessary part of the UID? Does the relationship help uniquely identify the entity? In other words, is it an absolutely necessary part of the UID? Is the relationship one and only one in the direction from the entity? Is the relationship one and only one in the direction from the entity? Is it mandatory if it is part of the primary UID? Is it mandatory if it is part of the primary UID? Search for Attributes and Relationships to Identify Each Entity 3-67

9 Copyright Ó Oracle Corporation, 1998. All rights reserved. Validate the Unique Identifier Examine the sample data. Does the selected combination of attributes and relationships truly uniquely identify each occurrence of an entity? Examine the sample data. Does the selected combination of attributes and relationships truly uniquely identify each occurrence of an entity? What “ business rules ” will the user have to live by in terms of adding, deleting, or updating occurrences of the entity based on the choice of UIDs? What will they be able to do or not do? What “ business rules ” will the user have to live by in terms of adding, deleting, or updating occurrences of the entity based on the choice of UIDs? What will they be able to do or not do? Are all the attributes and relationships that are included in the primary UID mandatory? Are all the attributes and relationships that are included in the primary UID mandatory? Search for Attributes and Relationships to Identify Each Entity 3-67

10 Copyright Ó Oracle Corporation, 1998. All rights reserved. Exercise 3-8 - UIDs For the Training Company situation and E-R model from Exercise 3-5, supply attribute tags for each attribute, and identify all UIDs for each entity. Add tags and UIDs to the model. taught by the teacher of INSTRUCTOR(TEACHER) name name phone number phone number COURSE code code name name fee fee duration duration STUDENT name name phone number phone number enrolled in taken by 3-69

11 Copyright Ó Oracle Corporation, 1998. All rights reserved. Exercise 3-9 Identify UIDs For the Video Store situation and E-R model from Exercise 3-6, identify a UID for each entity and add these UIDs to the E-R model. Also, supply attribute tags for each attribute. “ I ’ m the owner of a small video store. We have over 3,000 video tapes that we need to keep track of. Each of our video tapes has a number. For each movie, we need to know its title and category (e.g. comedy, suspense, drama, action, war, or sci-fi). Yes, we do have multiple copies of many of our movies. We give each movie a specific id, and then track which movie a tape contains. A tape may be either Beta or VHS format. We always have at least one tape for each movie we track, and each tape is always a copy of a single, specific movie. Our tapes are very long, and we don ’ t have any movies which require multiple tapes. We are frequently asked for movies starring specific actors. John Wayne and Katherine Hepburn are always popular. So we ’ d like to keep track of the star actors appearing in each movie. Not all of our movies have star actors. Customers like to know each actor ’ s “ real ” birth name and date of birth. We track only actors who appear in the movies in our inventory. We have lots of customers. We only rent videos to people who have joined our “ video club. ” To belong to our club, they must have good credit (if they don ’ t they are not included in who we consider customers). Then we need to keep track of what video tapes each customer currently has checked out. A customer may check out multiple video tapes at any given time. We just track current rentals. “ I ’ m the owner of a small video store. We have over 3,000 video tapes that we need to keep track of. Each of our video tapes has a number. For each movie, we need to know its title and category (e.g. comedy, suspense, drama, action, war, or sci-fi). Yes, we do have multiple copies of many of our movies. We give each movie a specific id, and then track which movie a tape contains. A tape may be either Beta or VHS format. We always have at least one tape for each movie we track, and each tape is always a copy of a single, specific movie. Our tapes are very long, and we don ’ t have any movies which require multiple tapes. We are frequently asked for movies starring specific actors. John Wayne and Katherine Hepburn are always popular. So we ’ d like to keep track of the star actors appearing in each movie. Not all of our movies have star actors. Customers like to know each actor ’ s “ real ” birth name and date of birth. We track only actors who appear in the movies in our inventory. We have lots of customers. We only rent videos to people who have joined our “ video club. ” To belong to our club, they must have good credit (if they don ’ t they are not included in who we consider customers). Then we need to keep track of what video tapes each customer currently has checked out. A customer may check out multiple video tapes at any given time. We just track current rentals. 3-70


Download ppt "Copyright Ó Oracle Corporation, 1998. All rights reserved. Assign Unique Identifiers A Unique Identifier (UID) is any combination of attributes and/or."

Similar presentations


Ads by Google