Presentation on theme: "IT420: Database Management and Organization"— Presentation transcript:
1 IT420: Database Management and Organization Introduction to ER ModelAdina Crăiniceanu
2 Lab Lab 1 due next Tuesday (January 17) before class You do not have to enforce the rule Landing > TakeoffSend created database to
3 Last Time Why Database Management Systems? Microsoft Access TransactionsHigh-level abstractions for data access, manipulation, and administrationData integrity and securityPerformance and scalabilityMicrosoft Access
4 Goals of This LectureUnderstand the Entity-Relationship Model
5 Database Design Process Requirements analysisConceptual design data modelLogical designSchema refinement: NormalizationPhysical tuning
6 Conceptual Design Overview ER ModelWhat are the entities and relationships in the enterprise?What information about these entities and relationships should we store in the database?What are the integrity constraints or business rules that hold?
7 Data Model A data model is a plan, or blueprint, for a database. GeneralAbstract (no implementation suggested)Easy to change
8 ER ModelEntity-Relationship model: set of concepts and graphical symbolsVersionsOriginal E-R model — Peter Chen (1976)Extended E-R model — Extensions to the Chen modelInformation Engineering (IE) — James Martin (1990) “Crow’s foot” notationIDEF1X — A national standard developed by the National Institute of Standards and TechnologyUnified Modeling Language (UML) — The Object Management Group; it supports object-oriented methodology
9 Entities Something that can be identified and the users want to track Entity class — a collection of entities of a given typeEntity instance — the occurrence of a particular entityThere are usually many instances of an entity in an entity class.
14 Identifiers Identifiers = attributes that identify entity instances Composite identifiers: Identifiers that consist of two or more attributesIdentifiers in data models become keys in database designs:Entities have identifiers.Tables (or relations) have keys.
16 Relationships Relationships: associations between entities Relationship classes: associations among entity classesRelationship instances: associations among entity instancesNo attributesRelationship degree: Number of entities in the relationship
19 Cardinality Cardinality means “count,” and is expressed as a number Maximum cardinality: maximum number of entity instances that can participate in a relationshipMinimum cardinality: minimum number of entity instances that must participate in a relationship
20 Maximum CardinalityMaximum cardinality: maximum number of entity instances that can participate in a relationshipOne-to-One [1:1]One-to-Many [1:N]Many-to-Many [N:M]
28 Data Modeling Notation: N:M and O-M Note that:(1) ERwin cannot indicate true minimum cardinalities on N:M relationships(2) Visio introduces the intersection table instead of using a true N:M model
29 ID-Dependent Entities ID-dependent entity: entity (child) whose identifier includes the identifier of another entity (parent)Example:BUILDING : APARTMENTPAINTING : PRINTMinimum cardinality from the ID-dependent entity to the parent is always one
30 ID-Dependent Entities A solid line indicates an identifying relationship
31 Weak EntitiesA weak entity is an entity whose existence depends upon another entity.All ID-Dependent entities are considered weak.But there are also non-ID-dependent weak entities.The identifier of the parent does not appear in the identifier of the weak child entity.
32 Weak Entities (Continued) Weak entities must be indicated by an accompanying text box in Erwin – There is no specific notation for a nonidentifying but weak entity relationshipA dashed line indicates a nonidentifying relationship
33 ID-Dependent and Weak Entities ID-Dependent entity: Identifier depends includes another identifierIdentifying relationshipEx: BUILDING:APARTMENTWeak entity: existence depends on another entityEx: MODEL:CARID-Dependent WeakWeak does NOT imply ID-Dependent
34 Subtype Entities Subtype entity: special case of a supertype entity: STUDENT : UNDERGRADUATE or GRADUATESupertype:all common attributes[discriminator attribute]Subtypes:specific attributes.
38 Subtypes: IS-A relationships IS-A relationships: a subtype IS A supertype.Supertype and subtypes identifiers are identicalUse subtypes ifHave attributes that make sense only for subtypesWant to specify a relationship only for subtype or supertype
39 Class ExerciseDraw ER diagram for a database used to manage IT420 class (at least 3 entities)Specify entities, attributes, identifiersSpecify relationshipsSpecify cardinalities for relationships
40 ER Modeling: Case Study Drugwarehouse.com has offered you a free life-time supply of prescription drugs (no questions asked) if you design its database schema. Given the rising cost of health care, you agree. Here is the information that you gathered:Patients are identified by their SSN, and we also store their names and ageDoctors are identified by their SSN, and we also store their names and specialtyEach patient has one primary care physicianEach doctor has at least one patient