logging in or signing up csce520 lect2 VolteMort Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 656 Category: Entertainment License: All Rights Reserved Like it (1) Dislike it (0) Added: November 16, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... By: binduz (39 month(s) ago) pls send this ppt to binbin656@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: mohamedmeeran (46 month(s) ago) it, was very good , how can i down lode this. Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript ENTITY-RELATIONSHIP (E/R) MODEL: ENTITY-RELATIONSHIP (E/R) MODELReading and Exercises: Reading and Exercises Database Systems- The Complete Book: Chapter 2 Self testing exercises: 2.1.3 and 2.1.4 2.2.4 2.3.1.b Any of the remaining exercises in the textbook Following lecture slides are modified from Jeff Ullman’s slides for Fall 2002 -- StanfordPurpose: Purpose Informal Database Design Entity-relationship diagram Easy to convert to implementations (e.g., relational databases)Entity Sets: Entity Sets Database: collection of entities and relationship among entities Entity: object that exists and distinguishable from other objects Entity set: collection of similar objects Attribute: property of an entity set Each entity in the set has the same propertiesAttributes : Attributes Domain: set of permitted values for each attributes Attribute types: Simple vs. composite Single-valued v.s. multi-valued Derived E/R Diagram: E/R Diagram Entity sets: diagrams Attributes: oval Relationship sets between entity sets: diamondExample E/R Diagram: Example E/R Diagram Dog Name Breed Age License # Phone Weight Name Name Phone Address Owns Owner Kennel Pays BoardsRelationship Set: Relationship Set Current value of an entity set is the set of entities that belong to it Value of a relationship is a set of lists of currently related entities (one from each entity sets)Example: Example Example of the Owns relationDegree of Relationship Sets: Degree of Relationship Sets Number of entity sets participating in a relationship set Binary relationship set: two entity sets (most common) Multiway relationship set: connects more than two entity sets E.g., An owner frequents certain kennels for certain dogs Binary relationship can’t represent these requirements Need 3-way relationshipSlide11: Example 3-Way Diagram Dog Owner Kennel Name Breed Age License # Phone Weight Name Name Phone Address Must BoardSlide12: Example 3-Way Relation Example of the Must-Board relationMapping Cardinality: Mapping Cardinality Number of entities to which another entity can be associated via a relationship set One-one Many-one (One-many) Many-manyOne-One Relationship: One-One Relationship Each entity of either entity set is related to at most one entity of the other set E.g., assume each owner is allowed to have only 1 dog, and each dog must belong to 1 owner. The Owns relation between Dog and Owner is one-oneMany-One Relationship: Many-One Relationship Each entity of the first set is connected to at most one entity in the second set Entities in the second set can connect to 0, 1, 2, or more entities of the first set. E.g., assume, each dog has at most 1 owner, but an owner may have any number of dogs. TheOwns relation from Dog to Owner is is many-one.Many-Many Relationship: Many-Many Relationship Entity of either set can be connected to many entities of the other set E.g., assume that a dog may belong to several persons, and a person may have any number of dogs. The Own relation between Dog and Owner is many-manyCardinality of Relationships: Cardinality of Relationships one-one many-one many-manyRepresenting Cardinality: Representing Cardinality One-one: arrow in each side of the relationship Many-one: arrow on the “one” side Exactly one: each entity of the one set must be related to exactly on entity of the other set. Rounded arrow on the “one” sideRelationship Attribute: Relationship Attribute Relationships may have attributes Property of the relationship E.g., amount the owners pays to the kennel for boarding their dog AmountRelationship Attribute: Relationship Attribute Other representation: Create an entity set to represent relationship property Create 3-way relationship among all entitiesRelationship Attributes: Relationship Attributes Owner Kennel Pays Cost AmountRoles: Roles Entity set may appear more then once in a relationship Label the edges between the relationships and the entity set with names called roles. E.g., relationships among the dogs: Dog Related to ancestor descendantSubclasses in E/R: Subclasses in E/R Special case, fewer entities, more properties E.g., show dog is a dog, but not all dogs are show dogs. It also have properties, type of competition, rank, etc. Assume subclasses form a tree (no multiple inheritance) ISA relationshipExample Subclass: Example Subclass Dog Name Breed Age Weight Show-Dog Rank Type ISAKeys: Keys Set of attributes for one entity set such that no two entities in the set has the same value for all the attributes of the key Each entity set must have a keyKeys: Keys Super key: set of one or more attributes whose value iniquely determine each entity Candidate key: minimal super key Primary key: a selected candidate keyKeys in E/R Diagram: Keys in E/R Diagram Underline the key attributes In ISA hierarchy: only the root entity set has a key, it is also a key for all subclassesExample Key for Owner : Example Key for Owner Phone Name OwnerSlide29: Example Multi-Attribute Key for Owner Phone Name Owner Address There are more than One person with the Same name, but they Live at different Places.Weak Entity Sets: Weak Entity Sets Entities of an entity set need “help” to identify them uniquely Entity set E is said to be weak if in order to identify entities of E uniquely, we need to follow one of more many-one relationships from E and include the key of the related entities from the connected entity sets.Example – Weak Entity Set: Example – Weak Entity Set Dog Name Breed Phone Name Owns Owner Name and breed do not uniquely Identify a dog. However, name and breed and The name of the owner will Uniquely identify a dog. Representation: double line Around relationship diamond. Many-one relationshipKeys for Relationship Sets: Keys for Relationship Sets Combination of primary keys of participating entity sets Must consider mapping cardinalities to choose the candidate keys Need semantics of relationship set for selecting primary keyDesign Techniques: Design Techniques Avoid redundancy Limit use of weak entity sets Don’t use entity set when can use attribute Binary v.s. multiway relationship setsAvoid Redundancy: Avoid Redundancy Repeat the same thing in two or more different ways Bad because: Wastes space Encourages inconsistencySlide35: Dog Name Breed Age Phone Weight Name Owns Owner Good Design: Avoid Redundancy Name of the owner Listed only once For each dogSlide36: Dog Name Breed Age Phone Weight Name Owns Owner Bad Design: Avoid Redundancy Name of the owner Listed twice, once for each dog and once For the relationship Owns Owner Entity Set v.s. Attribute: Entity Set v.s. Attribute Good BadWeak Entity Set: Weak Entity Set Try to create unique ids for entity sets Use weak entity sets only if impossible to create unique ids E.g., can not require all dog owners to give unique names for their petsStudent Oracle Accounts: Student Oracle Accounts Some helpful web links: https://www.cse.sc.edu -> My CSE Account -> Oracle account http://www.cse.sc.edu/~okeefe/tutorials/oracle_sqlplus/601.html You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
csce520 lect2 VolteMort Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 656 Category: Entertainment License: All Rights Reserved Like it (1) Dislike it (0) Added: November 16, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... By: binduz (39 month(s) ago) pls send this ppt to binbin656@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: mohamedmeeran (46 month(s) ago) it, was very good , how can i down lode this. Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript ENTITY-RELATIONSHIP (E/R) MODEL: ENTITY-RELATIONSHIP (E/R) MODELReading and Exercises: Reading and Exercises Database Systems- The Complete Book: Chapter 2 Self testing exercises: 2.1.3 and 2.1.4 2.2.4 2.3.1.b Any of the remaining exercises in the textbook Following lecture slides are modified from Jeff Ullman’s slides for Fall 2002 -- StanfordPurpose: Purpose Informal Database Design Entity-relationship diagram Easy to convert to implementations (e.g., relational databases)Entity Sets: Entity Sets Database: collection of entities and relationship among entities Entity: object that exists and distinguishable from other objects Entity set: collection of similar objects Attribute: property of an entity set Each entity in the set has the same propertiesAttributes : Attributes Domain: set of permitted values for each attributes Attribute types: Simple vs. composite Single-valued v.s. multi-valued Derived E/R Diagram: E/R Diagram Entity sets: diagrams Attributes: oval Relationship sets between entity sets: diamondExample E/R Diagram: Example E/R Diagram Dog Name Breed Age License # Phone Weight Name Name Phone Address Owns Owner Kennel Pays BoardsRelationship Set: Relationship Set Current value of an entity set is the set of entities that belong to it Value of a relationship is a set of lists of currently related entities (one from each entity sets)Example: Example Example of the Owns relationDegree of Relationship Sets: Degree of Relationship Sets Number of entity sets participating in a relationship set Binary relationship set: two entity sets (most common) Multiway relationship set: connects more than two entity sets E.g., An owner frequents certain kennels for certain dogs Binary relationship can’t represent these requirements Need 3-way relationshipSlide11: Example 3-Way Diagram Dog Owner Kennel Name Breed Age License # Phone Weight Name Name Phone Address Must BoardSlide12: Example 3-Way Relation Example of the Must-Board relationMapping Cardinality: Mapping Cardinality Number of entities to which another entity can be associated via a relationship set One-one Many-one (One-many) Many-manyOne-One Relationship: One-One Relationship Each entity of either entity set is related to at most one entity of the other set E.g., assume each owner is allowed to have only 1 dog, and each dog must belong to 1 owner. The Owns relation between Dog and Owner is one-oneMany-One Relationship: Many-One Relationship Each entity of the first set is connected to at most one entity in the second set Entities in the second set can connect to 0, 1, 2, or more entities of the first set. E.g., assume, each dog has at most 1 owner, but an owner may have any number of dogs. TheOwns relation from Dog to Owner is is many-one.Many-Many Relationship: Many-Many Relationship Entity of either set can be connected to many entities of the other set E.g., assume that a dog may belong to several persons, and a person may have any number of dogs. The Own relation between Dog and Owner is many-manyCardinality of Relationships: Cardinality of Relationships one-one many-one many-manyRepresenting Cardinality: Representing Cardinality One-one: arrow in each side of the relationship Many-one: arrow on the “one” side Exactly one: each entity of the one set must be related to exactly on entity of the other set. Rounded arrow on the “one” sideRelationship Attribute: Relationship Attribute Relationships may have attributes Property of the relationship E.g., amount the owners pays to the kennel for boarding their dog AmountRelationship Attribute: Relationship Attribute Other representation: Create an entity set to represent relationship property Create 3-way relationship among all entitiesRelationship Attributes: Relationship Attributes Owner Kennel Pays Cost AmountRoles: Roles Entity set may appear more then once in a relationship Label the edges between the relationships and the entity set with names called roles. E.g., relationships among the dogs: Dog Related to ancestor descendantSubclasses in E/R: Subclasses in E/R Special case, fewer entities, more properties E.g., show dog is a dog, but not all dogs are show dogs. It also have properties, type of competition, rank, etc. Assume subclasses form a tree (no multiple inheritance) ISA relationshipExample Subclass: Example Subclass Dog Name Breed Age Weight Show-Dog Rank Type ISAKeys: Keys Set of attributes for one entity set such that no two entities in the set has the same value for all the attributes of the key Each entity set must have a keyKeys: Keys Super key: set of one or more attributes whose value iniquely determine each entity Candidate key: minimal super key Primary key: a selected candidate keyKeys in E/R Diagram: Keys in E/R Diagram Underline the key attributes In ISA hierarchy: only the root entity set has a key, it is also a key for all subclassesExample Key for Owner : Example Key for Owner Phone Name OwnerSlide29: Example Multi-Attribute Key for Owner Phone Name Owner Address There are more than One person with the Same name, but they Live at different Places.Weak Entity Sets: Weak Entity Sets Entities of an entity set need “help” to identify them uniquely Entity set E is said to be weak if in order to identify entities of E uniquely, we need to follow one of more many-one relationships from E and include the key of the related entities from the connected entity sets.Example – Weak Entity Set: Example – Weak Entity Set Dog Name Breed Phone Name Owns Owner Name and breed do not uniquely Identify a dog. However, name and breed and The name of the owner will Uniquely identify a dog. Representation: double line Around relationship diamond. Many-one relationshipKeys for Relationship Sets: Keys for Relationship Sets Combination of primary keys of participating entity sets Must consider mapping cardinalities to choose the candidate keys Need semantics of relationship set for selecting primary keyDesign Techniques: Design Techniques Avoid redundancy Limit use of weak entity sets Don’t use entity set when can use attribute Binary v.s. multiway relationship setsAvoid Redundancy: Avoid Redundancy Repeat the same thing in two or more different ways Bad because: Wastes space Encourages inconsistencySlide35: Dog Name Breed Age Phone Weight Name Owns Owner Good Design: Avoid Redundancy Name of the owner Listed only once For each dogSlide36: Dog Name Breed Age Phone Weight Name Owns Owner Bad Design: Avoid Redundancy Name of the owner Listed twice, once for each dog and once For the relationship Owns Owner Entity Set v.s. Attribute: Entity Set v.s. Attribute Good BadWeak Entity Set: Weak Entity Set Try to create unique ids for entity sets Use weak entity sets only if impossible to create unique ids E.g., can not require all dog owners to give unique names for their petsStudent Oracle Accounts: Student Oracle Accounts Some helpful web links: https://www.cse.sc.edu -> My CSE Account -> Oracle account http://www.cse.sc.edu/~okeefe/tutorials/oracle_sqlplus/601.html