IE 423 – Design of Decision Support Systems Data modeling and database development.

Slides:



Advertisements
Similar presentations
Relational Model (CB Chapter 4) CPSC 356 Database Ellen Walker Hiram College.
Advertisements

Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
1 Logical Database Design and the Relational Model Modern Database Management.
Systems Development Life Cycle
Modeling the Data: Conceptual and Logical Data Modeling
Database Design & Mapping
Systems Development Life Cycle
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
Entity-Relationship Model and Diagrams (continued)
Information Resources Management February 13, 2001.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
CHAPTER 2: MODELING DATA IN THE ORGANIZATION © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey.
Thomas Connolly and Carolyn Begg’s
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Database Architecture The Relational Database Model.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
Chapter 3: Modeling Data in the Organization
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Module Title? DBMS E-R Model to Relational Model.
Web-Enabled Decision Support Systems
Converting ER model Into Relational Table
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
PLUG IT IN 3 Fundamentals of Relational Database Operations.
Fundamentals of Relational Database Operations
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.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Chapters 15 &16 Conceptual and Logical Database Design Methodology.
CS 370 Database Systems Lecture 9 The Relational model.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Databases Illuminated Chapter 3 The Entity Relationship Model.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
IE 423 – Design of Decision Support Systems Data modeling and database development.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
IE 423 – Design of Decision Support Systems Data modeling and database development.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 2: MODELING DATA.
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: Modeling Data in the Organization Modern Database Management 9 th Edition Jeffrey.
Lecture 4: Logical Database Design and the Relational Model 1.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
Logical Database Design and Relation Data Model Muhammad Nasir
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Logical Database Design and the Rational Model
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 5: Logical Database Design and the Relational Model
Entity-Relationship Model
MIS 322 – Enterprise Business Process Analysis
Tables and Their Characteristics
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
INSTRUCTOR: MRS T.G. ZHOU
Presentation transcript:

IE 423 – Design of Decision Support Systems Data modeling and database development

Important Dates to Remember 0 days – Leap Day 3 days – Midterm Exam – March 3 rd 17 days – St. Patrick’s Day 19 days – DSS Analysis Report Due 22 days – Spring Break

By now you should have Read Chapters 1,2,3 and 4 in Pol and Ahuja Also, read chapter 5 in Pol and Ahuja

Data Modeling Now that you have explored the creation of Object models and Entity- Relation models… The next steps is to create relational data models

Data Modeling Relational Data Models Idea developed by E. F. Codd from IBM (published in 1970) Based on the idea of relational algebra Three major components Relational Data Structure (entities, attributes, relationships) Data Manipulation – methods, language, etc. manipulating data –Relational Data Integrity – Rules to insure structural and data integrity is maintained

Data Modeling Relational Data Structure – Relation is a is a 2 dimensional grid like data structure (rows and columns) Relation is the set of attributes “defining” an entity (columns)… …by a variable number of entity instances (rows) Notation for a relation  Student(ID, Name, Rank, , Major)  Number of attributes (columns)= Degree of Relation  Number of instances (rows) = Cardinality of Relation Above notation referred to as Relational Schema

Data Modeling Properties of a Relation Each relation has a unique name Each attribute of an instance (row) is a simple (atomic) value Each record is unique Each attribute has a distinct name All values of a given attribute must be from the same domain Order of attributes not important Order of instances (rows) not important

Data Modeling E-R Diagram Rectangle = relation Ellipses = attributes Student ID Name Rank Major

Data Modeling Data manipulation Method and procedures for manipulating data in relations  Usually a language  Can be done with GUI controls  Usually still a language  Structured Query Language – SQL SELECT ID, Name, Rank FROM Student WHERE Rank = Senior

Data Modeling Relational Data Integrity Constraints Basically rule to assure that relations and relationships are properly maintained as data is manipulated Probably the one you will hear most is  Referential Integrity

Data Modeling Keys Remember that each instance must be unique You must have one or more attributes that make the instance unique Relational Keys

Data Modeling Keys Super Keys = Any set of one or more attributes that will make an instance unique  Student(ID, Name, )  Student(ID)  Student( ) Candidate Key = the simpliest super key, may be more than one  Student(ID)  Student( )

Data Modeling Keys Primary Key – a candidate key selected to uniquely identify each instance (record) Primary Key can never have a Null value Cannot change values of Primary Key  Bad Primary Keys Student(LastName) Student( )  Probably good Student(ID)

Data Modeling Keys Foreign Keys – in a relationship (multiple relations) an attribute in one entity that is a Primary key in the other entity, Or is the primary key in the same relation (we’ll come back to this) Attribute must be in common in both entities in the relationship Foreign keys do not need to be unique  Student(ID, Name, Rank, Major)  Majors(MajorCode, MajorTitle) (Foreign key= MajorCode) There are some important ideas about Foreign Keys

Data Modeling Data Integrity Constraints Domain constraints  All values of a given attribute must be from the same domain Entity Constraints  Every relation must have a primary key  Primary key must be unique  Primary key cannot have a Null value Referential Constraints  Insures relationship between Primary and Foreign keys  Values of foreign keys must come from the primary key in related relation…  …or foreign key may Null

Data Modeling Translate E-R model to Relational Schema Task 1: translate regular entities to schema Translate entity in E-R model to relation Assign entity name as relation name Each simple attribute in entity= attribute in relation Unique identifier of entity = primary key of relation

Data Modeling Task 1: translate regular entities to schema Student ID Name Rank Major Student(ID, Name, Rank, Major) Student IDNameRankMajor

Data Modeling Task 2:translate composite attributes to simple attributes Student(ID, Name, Rank, Address) == Student(ID, Name, Rank, Street, City, State,…)

Data Modeling Task 2:translate composite attributes to simple attributes Student(ID, Name, Rank, Major, Address) == Student(ID, Name, Rank, Major, Street, City, State,…) Student IDNameRankMajorStreetCityStateZip Student IDNameRankMajorAddress

Data Modeling Task 3: Transform multivalue attributes Create relation for entity Do not include multivalue attribute in relation Create another relation to represent the multivalue attribute  Each value of the multivalue attribute is an instance (record) in new relation  Make relation between new relation and original relation  Make foreign key in new relation that is equal to primary key of original instance

Data Modeling Task 3: Transform multivalue attributes Create relation for entity Do not include multivalue attribute in relation Create another relation to represent the multivalue attribute  Each value of the multivalue attribute is an instance (record) in new relation  Make relation between new relation and original relation  Make foreign key in new relation that is equal to primary key of original instance

Data Modeling Task 3: Transform multivalue attributes Applicants(Name, ID, Skills(skill,skill,…) -> Applicants(Name, ID) + Skills(ID, Skill) (ID = foreign key) Applicants NameID Skills IDSkill

Data Modeling Task 4: Transforming Unary Relationships Remember: unary relationships involve only one entity, therefore, one relation Three types of unary relationships  No relationship – simple relation – task 1-3 (3*)  One-to-One relationship  One-to-Many relationship

Data Modeling Task 4: Transforming Unary Relationships One-to-One – do task 1-3 (3*) Create one relation Add an attribute that will be a foreign key  Matches primary key in same relation  Each instance will unique value in foreign key DormResidents NameRoomNoID DormResidents NameRoomNoIDRoommate

Data Modeling Task 4: Transforming Unary Relationships One-to-Many – do task 1-3 (3*) Create one relation Add an attribute that will be a foreign key  Matches primary key in same relation  Each instance will unique value in foreign key DormResidents NameRoomNoID DormResidents NameRoomNoIDRA

Data Modeling Task 5: Transforming Binary Relationships Remember: binary relationships involve two entities, therefore, two relations Three types of binary relationships  One-to-One relationship  One-to-Many relationship  Many-to_Many relationship

Data Modeling Task 5: Transforming Binary Relationships One-to-One relationship – one instance in one relation matches one instance in the other relation Tasks 1-3 for each entity/relation Define relationship  Link primary key in one relation to primary key other relation StudentInfo(ID, Name, Rank, Major) + StudentContact(ID, , phone, AddrStreet,…) Relationship based on ID (common in both relations) ID is primary key in both relations

Data Modeling Task 5: Transforming Binary Relationships One-to-Many relationship – one instance in one relation matches multiple instances in the other relation Tasks 1-3 for each entity/relation Define relationship  Link primary key in one relation to primary key other relation Dorm(DormID, DormName, MainPhone) + StudentInfo(ID, Name, DormID) Relationship based on DormID (common in both relations) DormID is foreign key in StudentInfo relation but but primary key in Dorm relation

Data Modeling Task 5: Transforming Binary Relationships One-to-Many relationship – one instance in one relation matches multiple instances in the other relation Tasks 1-3 for each entity/relation Define relationship  Link primary key in one relation to primary key other relation Dorm(DormID, DormName, MainPhone) + StudentInfo(ID, Name, DormID) Relationship based on ID (common in both relations) DormID is foreign key in StudentInfo relation but but primary key in Dorm relation

Data Modeling Task 5: Transforming Binary Relationships Many-to-Many relationship – multiple instances in one relation matches multiple instances in the other relation Consider a class registration system - you have multiple students that can multiple classes and you have multiple classes each which may have multiple students Given these two relations  Student(StudentID, Name, Rank, Major)  Course(CourseID, Name, CRN, Instructor) So how do you create a binary relationship between these two relations? You can’t!

Data Modeling Task 5: Transforming Binary Relationships Many-to-Many relationship – multiple instances in one relation matches multiple instances in the other relation You have to convert it to a ternary relationship What’s a ternary relationship? Involves three entity/relations Where does the third entity come from?

Data Modeling Task 5: Transforming Binary Relationships Answer: you create it! Add a third relation This relation has three attributes (can have more)  A unique identifier for each instance in new relation (primary key)  A foreign key to link the instance to an instance in relation A  A foreign key to link the instance to an instance in relation B

Data Modeling Task 5: Transforming Binary Relationships Here’s the problem Course CourseIDNameCRNInstructor Students StudentIDNameRankMajor Relationship? Think about this!

Data Modeling Task 5: Transforming Binary Relationships Here’s the solution Course CourseIDNameCRNInstructor Students StudentIDNameRankMajor Registrations RegistIDStudentIDCourseID