Data Modeling using XML Schemas

Data Modeling using XML Schemas

The EntityRelationship Model Part I. Instructor: Mohamed Eltabakh [email protected] CS3431: C-Term 2013 1 Database Design Stages Application Requirements Conceptual Design Conceptual Schema Logical Design Logical Schema Physical Design Physical Schema 2 Conceptual Design

What is Conceptual Design? Concise representation of the DB application requirements Why Conceptual Design ? It helps to understand application requirements better It helps to communicate our understanding of application It helps to come up with a good design 3 Conceptual Design (Contd) Conceptual Models

ER Model ER (Entity-Relationship) Model, Our focus UML (Unified Modeling Language), ORM (Object Role Modeling), etc. Structures: Entities and Relationships Constraints An ER schema is represented using EntityRelationship Diagram (ERD) 4 Modeling A database can be modeled as:

Collection of entities, Relationship among entities. An entity is an object that exists and is distinguishable from other objects. Example: a person, company, event, bank account, store, etc. Entities have attributes Example: a person 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 5 ER: Entity Sets and Attributes Entity set : Represent a set of objects Attribute: property of an entity, has a domain In ER diagram Entity set rectangle Attribute Oval. Entity Set Student with attributes (sNumber, sName, sAge) sNumber sName Student sAge 6

Attributes Types Primitive attributes: Attribute stores a single value (Number, String, Boolean, Date, ) Composite attributes: An attribute can be divided into subattributes (each is primitive) Multi-values attributes: Attribute with many values Derived attributes: Attributes computed from others sNumber sName Student These are primitive attributes

sAge DoB 7 Complex Attributes Composite Attribute: address s tre e t c ity Multivalued Attribute: major s ta te major a d d re s s Student entity set with all its attributes Derived Attribute: Age sN um ber sN am e

m a jo r S tu d e n t DoB Age s Age Age a d d re s s s tre e t c it y s ta te 8 Relationship Types

Relationship: Association (connection) between entities sets Relationship Type: Class of relationships Representation: Use a diamond shape Relationship type HasTaken to represent Courses taken by Students sNumber cNumber Student sName Has Taken Course title 9 Relationships with Attributes

A relationship may have attributes These attributes do not belong to any of the connected entities. But they belong the relationship sNumber cNumber Student Has Taken Course sName title Relationship HasTaken has an attribute project which is the project the Student did for the Course sNumber cNumber Student

Has Taken sName Course title project 10 Example I (Simple Application) Suppliers have a name, and location. Products have a name, price, and number. Consumers have a name, and location. Suppliers supply products on certain dates, while consumers buy products of certain quantity How would you model this application? a) What are the entities and attributes? b) What are the relationships? 11

Modeling of Example I pNumbe r sName sPrice product date quantity supplies buys sName cName supplier consumer

sLoc cLoc This ER captures exactly what is written in text 12 Example II (More Complicated) Suppliers have a name, and location. Products have a name, and number. Consumers have a name, and location. Some Suppliers have established contracts to supply a certain Product to a particular Consumer for specially negotiated price at a given quantity. How would you model this application? 13 Modeling of Example II Model the relationship Supplier supplies Products to Consumers pNumber pName

Ternary relationship (three-way) Product sName cName Supply Supplier Consumer sLoc cLoc price qty 14 Binary vs. Multi-way Relationships pNumbe

r sName product price quantity buys supplies sName cName supplier sLoc consumer Binary relationship cLoc

15 ER Model so far Entities and entity sets Relationships Binary, ternary, multi-way Attributes For entity sets and relationship types Simple, composite, multi-valued, derived 17 What about an Exercise Assume

you are building a database for a Bank What are the entity sets, attributes, and relationships?? 18

Recently Viewed Presentations

  • How to Prepare Stipulation and Order Waiving Unassigned Arrears

    How to Prepare Stipulation and Order Waiving Unassigned Arrears

    It is recommended that you print a copy of this document first, then use the step-by-step instructions to complete the necessary forms. ... which you must will then file with the court. Proof of Service by Mail. Enter your information,...
  • graphics.ics.uci.edu

    graphics.ics.uci.edu

    Response of Linear System. Impulse: Signal with only one non-zero sample. Delta (δ[t]) is an impulse with non-zero sample at t = 0
  • Department of Medicine Quality Program Medical ICU Morbidity ...

    Department of Medicine Quality Program Medical ICU Morbidity ...

    Department of Medicine Quality Program Medical ICU Morbidity and Mortality Conference ... Patients were classified into three groups: low (LRINEC score ≤ 5, <50% risk for nec fasc), moderate (LRINEC score 6-7, 50-75% risk for nec fasc), and high risk...
  • Carmel Beaches - California Coastal Commission

    Carmel Beaches - California Coastal Commission

    The color distinction is due to the large amount of biogenic material being deposited in this beach system by Carmel River. Nearby Carmel City Beach to the north is a relatively closed system due to the headland between the two...
  • Ernest Hemingway - Home - Scott County Schools

    Ernest Hemingway - Home - Scott County Schools

    Hemingway: To die. Alone. In the rain. ... Hemingway had the Iceberg Theory regarding writing. He gives you the facts—those hard facts are the tip of the iceberg floating above water. Everything else—the supporting structure—floats beneath the water, out of...
  • PowerPoint Slides for Professors Spring 2010 Version This

    PowerPoint Slides for Professors Spring 2010 Version This

    Peltzman (1976) - Self-interested regulators engage in regulatory activities consistent with maximizing their political support. Meier (1988) - Regulation is shaped by bargaining between private interest groups within the existing political and administrative structure.
  • History and Alternate Views of Macroeconomics and The Modern ...

    History and Alternate Views of Macroeconomics and The Modern ...

    History and Alternate Views of Macroeconomics and The Modern Macroeconomic Consensus. Lesson 36. Sections 35, 36. Classical Macroeconomics (35) Money and Price Level. Classical economists claim that increasing the money supply has no effect on output, and only increased prices...
  • Got License, Got Freedom

    Got License, Got Freedom

    Occupational therapy practice framework: domain and process. American Journal of Occupational Therapy, 56, 609-639. American Occupational Therapy Association (2005). Driving and Community Mobility Statement. American Journal of Occupational Therapy, 59, 666-670. American Occupational Therapy Association (2005).