Data Modeling Yong Choi School of Business CSUB. Part # 2 2 Database Collection of data in electronic format – A digital library of organization Managed.

Slides:



Advertisements
Similar presentations
Entity-Relationship (ER) Modeling
Advertisements

BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Database Systems: Design, Implementation, and Management Tenth Edition
ENTITY RELATIONSHIP MODELLING
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Chapter 4 Entity Relationship (E-R) Modeling
Entity Relationship (ER) Modeling
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Systems Development Life Cycle
Data Modeling is an Analysis Activity
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Database Design & Mapping
1 Basic DB Terms Data: Meaningful facts, text, graphics, images, sound, video segments –A collection of individual responses from a marketing research.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
Chapter 3: Modeling Data in the Organization
1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB.
Chapter 3: Modeling Data in the Organization
CHAPTER 2: MODELING DATA IN THE ORGANIZATION © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey.
Chapter 4 Entity Relationship (E-R) Modeling
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
Data Modeling 1 Yong Choi School of Business CSUB.
APPENDIX C DESIGNING DATABASES
Data Modeling 1 Yong Choi School of Business CSUB.
Yong Choi School of Business CSUB
Yong Choi School of Business CSUB
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
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.
3.1 CSIS 3310 Chapter 3 The Entity-Relationship Model Conceptual Data Modeling.
Chapter 3: Modeling Data in the Organization
1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R.
Practice of ER modeling
1 Data Modeling 2 Yong Choi School of Business CSUB.
Database Systems: Design, Implementation, and Management Ninth Edition
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Chapter 2: Modeling Data in the Organization
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003, 2004.
Database Design Principles – Lecture 3
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.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 2: Modeling Data in the Organization.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 7 Data Modeling with Entity Relationship Diagrams
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
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.
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
2 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Data Models Why data models are important About the basic data-modeling.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: Modeling Data in the Organization Modern Database Management 9 th Edition Jeffrey.
Pree Thiengburanathum, CAMT, Chiang Mai University 1 Database System Modeling Data in the Organization October 31, 2009 Software Park, Bangkok Thailand.
IS 4420 Database Fundamentals Chapter 3: Modeling Data in the Organization Leon Chen.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Lecture 3: Modeling Data in the Organization Modern Database Management 9 th Edition Jeffrey.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Data Modeling for Database Design 1
ERD’s REVIEW DBS201.
Overview of Entity‐Relationship Model
Data Modeling for Database Design 2
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 3: Modeling Data in the Organization
Entity-Relationship Diagram (ERD)
Presentation transcript:

Data Modeling Yong Choi School of Business CSUB

Part # 2 2 Database Collection of data in electronic format – A digital library of organization Managed by one set of software that provides access to all the data No data redundancy, data inconsistency, poor security, application-data dependency...

Part # 2 3 Database Management System (DBMS) Database software Act as an interface between application and physical data files Support centralization of data Independent of specific computer programs small (MS Access), large/popular (Oracle)

Part # 2 4 Database Models Hierarchical (Tree) Models Network Model Relational Models

Part # 2 5 Relational Database Model In the relational data model the database is represented as a group of related tables. The relational data model was introduced in 1970 by E. F. Codd of IBM published a paper in CACM entitled "A Relational Model of Data for Large Shared Data Banks". It is currently the most popular model. The mathematical simplicity and ease of visualization of the relational data model have contributed to its success.

Part # 2 6 Relational Database A schematic diagram of a relational database (a) and a sample part of a relational database showing different tables (b)

Part # 2 7 Relational database and keys A relational database is a collection of tables that are related to one another based on a common field. A field, or a collection of fields, is designated as the primary key. The primary key uniquely identifies a record in the table. When the primary key of one table is represented in a second table to form a relationship, it is called a foreign key.

Part # 2 8 Primary Key Unique identifier – Last name vs. SS# Prevent confusion Cost of PK – SS# vs. finger print – Entity Integrity Rule Any primary key is allowed to accept null values.

Part # 2 9 Foreign Key An attribute in one table whose values must either match the primary key in another table or be null. The database must not contain any unmatched foreign key values.

Part # 2 10 Foreign Keys Student ID Last Name First Name Dor m 2144ArnoldBettySmit h 3122TaylorJohnJone s 3843SimmonsLisaSmit h 9844MacyBill 2837LeathHeatherSmit h 2293WrenchTimJone s DormResidence Director SmithAndrea Fernandez JonesDaniel Abidjan Primary Key Foreign Key Duplicated from primary key of Major entity (not unique)

Part # 2 11 Foreign Keys

Part # 2 12 Relating tables using a common field The primary key in the Employer table (EmployerID) is the common field that relates this table to the Position table. PositionID is the primary key in the Position table. The EmployerID field is a foreign key in this table. Primary keys can only have one occurrence in a table. Foreign keys may have multiple occurrences.

Part # 2 13 Why Conceptual Data Modeling is Important? Effective Communication Tool User involvement Independence from a particular DBMS Documentation

Part # 2 14 Entity Relationship diagram (ERD) ERD is commonly used to: Translate different views of data among managers, users, and programmers to fit into a common framework. Define data processing and constraint requirements to help us meet the different views. Help implement the database. Developed by Peter Chen (1976).

Part # 2 ERD using Chen’ Notation

Part # 2 16 ER model using IE Notation

Part # 2 17 Basic Entity Relationship Diagram (ERD) Elements Entity : a collection of people, places, objects, events, concepts of interest (a table) Entity instance – a member of the Entity : a person, a place, an object … (a row in a table) Attribute - property or characteristic of interest of an entity (a field in a table) Relationship – association between entities (corresponds to primary key-foreign key equivalencies in related tables)

Part # 2 18 Entity What should be an Entity: An object that will have many instances in the database An object that will be composed of multiple attributes An object that we are trying to model What should NOT be an Entity: A user of the database system An output of the database system (e.g. a report)

Part # 2 19 Inappropriate entities System user System output Appropriate entities Entity …

Part # 2 20 Entity Instance Entity instance: a single occurrence of an entity. Student ID Last Name First Name 2144ArnoldBetty 3122TaylorJohn 3843SimmonsLisa 9844MacyBill 2837LeathHeather 2293WrenchTim instance entity

Part # 2 21 “describe the entity’s characteristics” Attributes are represented by an Ellipse/Oval connected to the entity with a line by Chen’s notation. Each oval contains the name of the attribute it represents. Entity: Employee Attributes:Employee-Name, Extension, Date-Of-Hire, Job-Skill-Code Attributes

Part # 2 ERD using Chen’ Notation

Part # 2 23 Classes of attributes Simple Attribute Composite Attribute Derived Attributes Single-valued Multi-valued Attribute

Part # 2 24 How to find entities and attributes?? Entity: a collection of people, places, objects, events, concepts of interest look for nouns Usually, a proper noun is not a good candidate…. Attribute: property or characteristic of interest of an entity look for attribute descriptive words

Part # 2 25 “attributes that uniquely identify entity instances” Uniquely identify every instance of the entity Composite identifiers are identifiers that consist of two or more attributes Entity:Employee Identifier:Social-Security-Number (unique) Identifier

Part # 2 26 Entities??? ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost. Also the organization would like to store the date the chemist was assigned to the project and the date an equipment item was assigned to a particular chemist working on a particular project. A chemist must be assigned at least to one project and one equipment item. Any given equipment item need not be assigned, and a given project need not be assigned either a chemist or an equipment item.

Part # 2 27 Entities Chemist Project Equipment

Part # 2 28 Attributes??? ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost. Also the organization would like to store the date the chemist was assigned to the project and the date an equipment item was assigned to a particular chemist working on a particular project. A chemist must be assigned at least to one project and one equipment item. Any given equipment item need not be assigned, and a given project need not be assigned either a chemist or an equipment item.

Part # 2 29 Entities & Attributes Project Proj# Start-Date Chemist Phone# Emp# Equipment Serial# cost How many attributes do you (as a entity of our school database) have? – name your attributes

Part # 2 30 Example 1: find entities A department hires many employee. A employee is employed by one department. A manager manages one department. A department is managed by one manager. A person must have only one DNA pattern and that pattern must be applied to only one person.

Part # 2 31 Example 2: find entities There are several departments in School of Business and Public Administration at CSUB. Each department belongs to one school. A department has many professors, but a professor may belong to more than one department. Similarly, courses may be offered by several departments and a department must have at least one course. A professor may teach more than one student, and a student may have more than one professor.

Part # 2 32 Example 4: Find all entities, attributes, and (unique) identifier The FANTASTIC video rental company has several branches throughout the USA. The data held on each branch is the branch address made up of street, city, state, and zip code, and the telephone number. Each branch is given a branch number, which is unique throughout the company. Each branch is allocated staff, which includes a Manager. The Manager is responsible for the day-today running of a given branch. The data held on a member of staff is his or her name, position, and salary. Each member of staff is given a staff number, which is unique throughout the company. Each branch has a stock of videos. The data held on a video is the catalog number, video number, title, category, daily rental, cost, status, and the names of the main actors, and the director. The catalog number uniquely identifies each video.

Part # 2 33 Example 4: Find all entities, attributes, and (unique) identifier (con’t) A customer must first register as a member of a local branch before renting a video tape from any branches. The data held on a member is the first and last name, address, and the date that the member registered at a branch. Each member is given a member number, which is unique throughout all branches of the company. Once registered, a member is free to rent videos, up to maximum of ten at any one time. The data held on each video rented is the rental number, the full name and number of the member, the video number, title, and daily rental, and the dates the video is rented out and date returned. The rental number is unique throughout the company.

Part # 2 34 Relationships Association between entities (by lines) Any connected entities are called participants Operate in both directions Relationship between Student and Curriculum A student is enrolled in many curriculums. Each curriculum is being studied by many students.

Part # 2 35 Relationships ??? ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost. Also the organization would like to store the date the chemist was assigned to the project and the date an equipment item was assigned to a particular chemist working on a particular project. A chemist must be assigned at least to one project and one equipment item. Any given equipment item need not be assigned, and a given project need not be assigned either a chemist or an equipment item.

Part # 2 36 Entities/Relationships & their Attributes Chemist Phone# Project Proj# Start-Date Equipment Works-On Uses Date-Assigned Emp# Serial# cost Assign-Date

Part # 2 37 Steps for creating an ERD Develop draft business rules Using interviews and documents Identify the entities (look for nouns) Identify the attributes (look for attribute descriptive words) identify draft business rules Identify the relationships (look for verb or verb phrases between entities) Identify cardinalities (look for participation related words and phrases such as zero, none, a, one, several, many…..) Optional (look for auxiliary verbs such as may, might, can and based upon own judgment..) Set business rules

Part # 2 38 Cardinality of Relationship One – to – One (1:1) Each instance in the relationship will have exactly one related member on the other side One – to – Many (1:M) A instance on one side of the relationship can have many related members on the other side, but a member on the other side will have a maximum of one related instance Many – to – Many (M:N) Instances on both sides of the relationship can have many related instances on the other side

Part # :1 relationship in set notation

Part # 2 40 Example of 1:1 relationship A one-to-one (1:1) relationship is when at most one instance of a entity A is associated with one instance of entity B. Each employee has a one’s own office. Cardinality toward the Office entity Each office is occupied by one employee. Cardinality toward the Employee entity

Part # :1 relationship A person must have one and only one DNA pattern and that pattern must apply to one and only one person.

Part # :M relationship in set notation

Part # 2 43 Example of 1:M relationship A one-to-many (1:N) relationships is when for one instance of entity A, there are zero, one, or many instances of entity B, but for one instance of entity B, there is only one instance of entity A. Each employee has many offices. Cardinality toward the Office entity Each office is occupied by one employee. Cardinality toward the Employee entity

Part # :M relationship Each department hires many employees, and each employee is hired by one department.

Part # 2 45 M:N relationship in set notation

Part # 2 46 Example of M:N relationship A many-to-many (M:N) relationship, sometimes called non-specific, is when for one instance of entity A, there are zero, one, or many instances of entity B and for one instance of entity B there are zero, one, or many instances of entity A. A employee has multiple offices. Cardinality toward the Office entity A office must be occupied by many employee. Cardinality toward the Employee entity

Part # 2 47 M:N relationship Each student takes many classes, and each class is taken by many students. ** This is not a desirable relationship.** STUDENT CLASS TAKE IS_TAKEN_BY

Part # 2 48 Complete ER Diagram Chemist Phone# Project Proj# Start-Date Equipment Works-On Uses Date-Assigned N 1 N1 Emp# Serial# cost Assign-Date

Part # 2 49 Cardinality Notations Cardinality Interpretation Minimum Instances Maximum Instances Graphic Notation Exactly one Zero or one One or many Zero or many Many (>1)

Part # 2 50 Steps for creating an ERD Develop draft business rules Using interviews and documents Identify the entities (look for nouns) Identify the attributes (look for attribute descriptive words) identify draft business rules Identify the relationships (look for verb or verb phrases between entities) Identify cardinalities (look for participation related words and phrases such as zero, none, a, one, several, many…..) Optional (look for auxiliary verbs such as may, might, can and based upon own judgment..) Set business rules