Conceptual DB Design Conceptual database design ERD’s.

Slides:



Advertisements
Similar presentations
Chapter # 4 BIS Database Systems
Advertisements

Entity Relationship Diagrams
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
CSC271 Database Systems Lecture # 22. Summary: Previous Lecture  Applying Database SDLC on DreamHome  Database planning  System definition  Requirements.
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Agenda for Week 1/31 & 2/2 Learn about database design
Chapter 3: Modeling Data in the Organization
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
APPENDIX C DESIGNING DATABASES
Data Modeling 1 Yong Choi School of Business CSUB.
Yong Choi School of Business CSUB
Data Modeling Using the Entity-Relationship Model
1 © Prentice Hall, 2002 CMIS564: E/R Modeling Dr. Bordoloi Based on Chapter 3; Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Data Modeling ERM ERD.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Chapter 5 Entity–Relationship Modeling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Conceptual Data Modeling, Entity Relationship Diagrams
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Data Modeling Yong Choi School of Business CSUB. Part # 2 2 Study Objectives Understand concepts of data modeling and its purpose Learn how relationships.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Chapter 8 Entity-Relationship Modeling Pearson Education © 2009.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Comp 1100 Entity-Relationship (ER) Model
Entity Relationship Modeling
Entity-Relationship Model
Chapter 9 Domain Models.
Entity Relationship Diagram
Databases Chapter 9 Asfia Rahman.
COP Introduction to Database Structures
Entity-Relationship Model
TMC2034 Database Concept and Design
Entity Relationship Model
© 2014 by McGraw-Hill Education. This is proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Entity Relationship (E-R) Modeling
DESIGNING DATABASE APPLICATIONS
Entity-Relationship Model
Tables and Their Characteristics
Chapter -3- Data Modeling Using the Entity-Relationship Model
Database Design – Lecture 4
Entity-Relationship Modelling
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
Entity-Relationship Modeling
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Entity Relationship Diagram
Overview of Entity‐Relationship Model
Entity Relationship Diagrams
Entity-Relationship Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Entity-Relationship Modelling
MIS2502: Data Analytics Relational Data Modeling
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 3: Modeling Data in the Organization
Entity-Relationship Diagram (ERD)
Presentation transcript:

Conceptual DB Design Conceptual database design ERD’s

Agenda: Attributes & related concepts Attribute Characteristics (qualities, properties) of an entity, or of a relationship There are many ways to describe attributes Related concepts Identifiers (attributes that identify rows) Domain (“value set”)  allowable values for attributes

Diagramming an attribute Our notation: rectangle under the entity name Employee EmployeeID Name Title BirthDate … Underline the primary key Show all attributes – I shortened the list of attributes here for display purposes but your diagram should show them all.

Entity/Attribute Example: Patient (Pt_ID, LastName, FirstName, SSN) LabResult (LabResult_ID, Pt_ID, LabDate, LabValue) Patient Pt_ID LastName FirstName SSN LabResult LabResult_ID Pt_ID LabDate LabValue LabResult_ID is surrogate key; instead of the composite of Pt_ID, LabDate, LabValue

All attributes are not the same Attributes can be characterized in various ways Simple or composite (compound) Single valued or multi-valued Derived or stored Identifiers Relationship attributes or entity attributes

Simple & Composite Attributes Simple attribute: one component AccountNumber Composite attribute: multiple components each of which could have an independent existence Address = Street, City, State, Zip Will users need to access any of the individual components (e.g., sort by zip code)?

Composite Attribute Group of attributes Some authors list the components together Address (street, city, state, zip) My preference: either list components as separate attributes, or just wait for logical design.

Single & Multi-valued attribute Single-valued: an attribute holds a single value for each entity instance Date of birth (attribute) Multi – valued: an entity instance (e.g. 1 person) could have more than one of this attribute Phone number (home, work, fax…)

Stored vs. Derived Stored In the database Derived Value can be determined from the value of a related attribute; calculated values May use data in database or other data such as date or time Glasgow Coma Scale (add up each part) Current Age (current date – date of birth)

Derived Attributes Some say do not put derived attributes on ERD. Some say put on ERD and then specify later that it’s a derived attribute. I do whichever approach will help me communicate with my users best

Identifier (Key) Attribute that uniquely identifies one instance of the entity Candidate Key(s) are the attribute/attribute sets that could uniquely identify an instance “Best” candidate becomes Primary Key Other candidates become Alternate Key Diagramming: underline the primary key, do not specify alternate keys (we’ll come back to them in logical design, though)

Diagramming attributes UML marks the key with a tag {PK} Primary Key {AK} Alternate Key We underline the PK, don’t specify alternate For this class show all the attributes of an entity In real life some people just show the keys or a partial list of attributes

Identifiers Primary keys Underline Place at top of list of attributes Alternate keys Like any other attribute Foreign keys Link to another table Don’t add to ERD (we’ll deal with them later). Only should be on ERD if part of the PK.

Strong/Weak Entity Types Strong Have an intrinsic primary key Does not depend on another entity for existence Weak No intrinsic primary key Can’t exist without a strong entity (“existence dependent”) Example of weak entity: Employee_Dependents (Name, relationship, gender) What is primary key? For each employee, it’s probably the dependent’s name. But that’s not unique within the table (both you and I could have kids with the same name) Could make this weak entity strong by adding Employee’s ID#

Strong/Weak Entity Rectangle with name inside top part (Name compartment) Weak entity: double line or thick line (I avoid whenever possible) Strong Weak

Relationship Attributes A relationship can have attributes – not a attribute of either entity separatly, but a property of the relationship Newspaper advertises PropertyForRent The Advertisement has a date and a cost Diagramming The text uses an un-named rectangle attached by a dashed line—but this can look on your diagram like an entity OUR NOTATION: We place the attributes with the relationship name, within square brackets

Relationship Attributes UnitPrice and Quantity are attributes of the relationship—they apply to products at the time they are sold in a specific order. They are not attributes of orders in general They are not attributes of products in general

Domain Allowable values for the attribute Examples: a data type (text, integer, real number, date) a data type with limits (real number >100.0) a data type with a business rule * an enumerated list specific list (A,B,C) a set of coded values – perhaps listed in another table (any value from xxx table)

Domain Business rule – how things are “done” IN THIS ORGANIZATION Some can be enforced through technology (all SBP values must be positive integer (>=0) and must be <= 350) Some cannot be enforced through technology. These are enforced through policy or procedure (“people” means). Example – “the last name field must be an actual person’s last name, not a random string of letters”

Domain First Name Sally, Frank, Jessie (specific names) All first name in use in USA Text of maximum length = 25 Birth date 1/2/54, 4/17/82 (formatted with 2 digit year) All dates after 1/1/1900 (range) Date type(general) Shippers from lstShip table

Values Comes from the domain A value is not the same as an attribute! The attribute is the property or category A value is a specific selection from the attribute domain, relevant to a specific instance of the entity

Values If you answer Yes/No, you are probably looking at a value, not an attribute, especially if you can only say yes to one of the choices Hand grasps (SSN, weak, strong, absent) WRONG Hand grasps (SSN, strength) RIGHT Domain for strength is “weak, strong, absent”

Review Entity: will become the TABLE Instance: will become the ROW (don’t put on ERD) Attribute: will become the COLUMN NAME (header) Primary Key: Unique identifier for a row Value: will become the actual data in a cell Relationship: how tables interact. We will use the relationships in the logical design process to determine where to put foreign keys.

Naming Conventions Entity Singular noun Relationship Verb phrase Label both directions (most of the time) Attributes Singular noun (usually) Plural noun can be used to indicate multi-valued attribute

A Note about Naming Keep names short but clear. Be consistent Avoid common “reserved words” (functions, data types…) Recommend: Begin with a letter, no spaces, no symbols other than underscore (this format is acceptable across most DBMSs)

Drawing conventions Underline Primary Key Don’t worry about foreign keys yet! Relationship is line between entities. Try to avoid crossing lines. No arrow on relationship line for basic ERD (arrows go above/below) Cardinalities go both directions at the point of arrow – above/below the line has  (1,*) (1,1)  belong to

General Drawing Principles Be neat Be consistent (e.g. entity width, fonts) Entity name centered, attributes left align Align entities where feasible

Assumptions Text notations that help to understand or clarify the drawing Short note on the drawing

Steps to create ERD’s (not necessarily in this order) Create entities Create relationships Add cardinalities Add attributes to entity Identify primary keys Add assumptions, notes, title

Avoiding Problems with your ERD Model DATA, not processes Don’t put “reports” on the ERD. Think about the data that go into the report, instead Think about your cardinalities. Know the difference between attributes and values/domain