Chapter 2: Entity-Relationship Model Basic Concepts Constraints Keys Design Issues E-R Diagram Weak Entity Sets Extended E-R Features Design of an E-R Database Schema Reduction of an E-R Schema to Tables 标 Database System Concepts 2.1 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.1 ©Silberschatz, Korth and Sudarshan Chapter 2: Entity-Relationship Model Basic Concepts Constraints Keys Design Issues E-R Diagram Weak Entity Sets Extended E-R Features Design of an E-R Database Schema Reduction of an E-R Schema to Tables
Basic Concepts Entity Sets a database can be modeled as a collection of entities relationship among entities An entity is an object that exists and is distinguishable from other objects Example: specific person, company, event, plant Entities have attributes Example: people have names and addresses An entity set is a set of entities of the same type that share the same properties Example: set of all persons, companies, trees holidays Database System Concepts 2.2 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.2 ©Silberschatz, Korth and Sudarshan Basic Concepts Entity Sets A database can be modeled as: a collection of entities, relationship among entities. An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant Entities have attributes Example: people have names and addresses An entity set is a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays
Entity Sets customer and loan customer-id customer- customer- customer- loan- amount name street city number 321-12-3123|ones Main Harrison L-171000 019-28-3746 Smith North Rye 2320 677-89-9011 Haves Main Harrison L-151500 555-55-5555 Jackson Dupont Woodside L-141500 244-66-8800 Curry North Rye L-195 963-96-3963 Williams Nassau Princeton L-11900 335-57-7991 Adams SpringPittsfield L-161300 customer loan Database System Concepts 2.3 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.3 ©Silberschatz, Korth and Sudarshan Entity Sets customer and loan customer-id customer- customer- customer- loan- amount name street city number
Basic Concepts(Cont) Attributes An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set Domain- the set of permitted values for each attribute Attribute types Simple and composite attributes Single-valued and multi-valued attributes E.g. multivalued attribute: phone-numbers Derived attributes Can be computed from other attributes E.g. age, given date of birth Database System Concepts 2 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.4 ©Silberschatz, Korth and Sudarshan Basic Concepts (Cont.) Attributes An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. Domain – the set of permitted values for each attribute Attribute types: Simple and composite attributes. Single-valued and multi-valued attributes – E.g. multivalued attribute: phone-numbers Derived attributes – Can be computed from other attributes – E.g. age, given date of birth
Composite Attributes Composite 11e address Attributes first-name middle-initial last-name street city state postal-code Component Attributes street-number street-name apartment-mumber Database System Concepts 2.5 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.5 ©Silberschatz, Korth and Sudarshan Composite Attributes