1 Introduction to modeling Relational modelling Slides for this part are based on Chapters 11 from Halpin, T. & Morgan, T. 2008, Information Modeling and.

Slides:



Advertisements
Similar presentations
The Relational Database Model
Advertisements

Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Systems Development Life Cycle
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
CS424 PK, FK, FD Normalization Primary and Foreign Keys Primary and foreign keys are the most basic components on which relational theory is based. Primary.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Database Architecture The Relational Database Model.
Chapter 5 Relational Model Concepts Dr. Bernard Chen Ph.D. University of Central Arkansas.
Exam 2 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
1 Relational model concepts Key constraints Referential integrity constraint Steen Jensen, autumn 2013.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
1 The Relational Data Model, Relational Constraints, and The Relational Algebra.
Chapter 4 The Relational Model.
Content Resource- Elamsari and Navathe, Fundamentals of Database Management systems.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Relational Data Model and Relational Database Constraints.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
THE RELATIONAL DATA MODEL CHAPTER 3 (6/E) CHAPTER 5 (5/E) 1.
Database Management COP4540, SCS, FIU Relational Model Chapter 7.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
Instructor: Churee Techawut Basic Concepts of Relational Database Chapter 5 CS (204)321 Database System I.
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 5 The Relational Data Model.
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
1 Introduction to modeling ER modelling Slides for this part are based on Chapters 8 from Halpin, T. & Morgan, T. 2008, Information Modeling and Relational.
1 Introduction to modeling Object-role modelling (ORM) Slides for this part are based on Chapters 3-7 from Halpin, T. & Morgan, T. 2008, Information Modeling.
Announcements Reading for Monday –4.6 Homework 3 – Due 9/29.
12/2/2015CPSC , CPSC , Lecture 41 Relational Model.
1 CS 430 Database Theory Winter 2005 Lecture 4: Relational Model.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Relational Model E.F. Codd at IBM 1970 Chapter 3 (ed. 7 – Chap. 5)
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
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.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
Lecture 03 Constraints. Example Schema CONSTRAINTS.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Introduction to modeling
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.
Lecture 4: Logical Database Design and the Relational Model 1.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Logical Database Design and Relation Data Model Muhammad Nasir
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
Chapter 4 The Relational Model Pearson Education © 2009.
1 Reference Scheme Reduction on Subtypes in ORM Andy Carver and Terry Halpin INTI International University, Malaysia
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
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.
Chapter 71 The Relational Data Model, Relational Constraints & The Relational Algebra.
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
RELATION.
Chapter 5: Logical Database Design and the Relational Model
CIS 207 The Relational Database Model
Lecture # 13 (After 1st Exam)
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Introduction to modeling
Presentation transcript:

1 Introduction to modeling Relational modelling Slides for this part are based on Chapters 11 from Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition (ISBN: ), published by Morgan Kaufmann Publishers.

2 Where are we? #TitleDate 1Introduction ORM modeling Relational modeling ER modeling OO modeling Process modeling Service modeling Exam

3 Relational model Data Model – Set of concepts to describe the structure of a database Relational Model – The database can be regarded as a collection of tables Key concepts: –Relation: A mathematical concept that can be interpreted as a table of values –Relational Database: A collection of relations null indicates that no value is stored in that position

4 Terminology Domain: An set of atomic values. –Atomic means that items can not themselves be sets Attribute: A name of a role played by a domain (column name) –If A is an attribute, we write dom(A) = D to express that A is a role played by the domain D Relational schema R(A 1,A 2, …,A n ): A named set of attributes R = {A 1,A 2, …,A n } where R is the relation name –n is the arity of the relationship Instance of a relational schema R(A 1,A 2, …,A n ): A set {t 1,t 2, …,t m } ("rows") where each t k is a n-tuple of values ​​ from the domain of A 1,A 2, …,A n Relation: A relational schema with an associated instance

5 Example empNrsalarytax Employee Relation name Tuppel Relation schema attribute instances Horizontal layout notation: the table name precedes a parenthesized list of column names, separated by commas: Employee (empNr, salary, tax )

6 Remarks Tuples’ order in relations is arbitrarily The order of values within a tuple is not arbitrary In one relations there cannot be two identical tuples A domain can be finite or infinite Two attributes in a relational schema can have the same domain, but not the same name

7 Uniqueness constraints on relational columns In horizontal layout, uniqueness constraints on relational columns are shown by underlining. Each unique column, or unique column combination, provides a candidate key for identifying rows in a table. –A key is a minimal set of uniquely constrained attributes, i.e. if an attribute is removed from a compound key, the remaining attributes are not spanned by a uniqueness constraint. If there is only one candidate key, this is automatically the primary key, e.g. –Employee (empNr, salary, tax) Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

8 Uniqueness constraints on relational columns If more than one candidate key exists, one of these must be selected as the primary key. The others are then called “alternate keys” or “secondary keys”. Primary keys are doubly underlined if alternate keys exist, e.g. –Employee (empNr, empName, deptCode, salary, tax) A column that does not allow null values is said to be mandatory (A column that does allow null values is said to be optional. Optional columns are enclosed in square brackets, e.g. –Employee (empNr, salary, [tax]) Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

9 Mapping ORM models => Employee (empNr, salary, [tax]) ? Relational model often requires different facts about the same object to be stored in different tables Mandatory role constraints are captured by making their columns mandatory in their table, and running a subset constraint from other tables (if any) that contain facts about that object type Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

10 Mapping ORM models Employee (empNr, salary, [tax]) WorksIn (empNr, project) => empNr in the WorksIn table is a foreign key

11 Integrity rules Entity integrity rule: primary keys contain no nulls (i.e., each column in a primary key is a mandatory column for its table). Referential integrity rule: each non-null value of a foreign key must match the value of some primary key Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

12 Relational schema representations Relational schema in horizontal layout and some vertical layouts: Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

13 Relational schema representations Relational schema in SQL: Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

14 Relational Mapping Procedure Rmap Several different relational designs may be possible for a given conceptual schema –But the resulting relational design should be correct, efficient, and clear A high priority is placed on simplifying the enforcement of constraints at update time –Avoid redundancy, but this can lead to more tables in the design –For efficiency, number of tables should be kept down to an acceptable limit Rmap procedure guarantees a redundancy-free relational design and includes strategies to restrict the number of tables Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

15 Rmap – basic rules Typically each row of a relational table stores one or more elementary facts Avoiding redundancy in tables: ensure that each fact type maps to only one table in such a way that its instances appear only once Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

16 Rmap – basic rules Two basic rules: 1.Each fact type with a compound, internal uniqueness constraint maps to a separate table by itself, keyed on the uniqueness constraint 2.Fact types with functional roles (i.e. roles that have a simple uniqueness constraint) attached to the same object type are grouped into the same table, keyed on the object type’s identifier Material on this slide based on Ch 11.2 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

17 Rmap - Mapping 1:1 Associations When no additional functional roles: When additional functional roles: Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

18 Rmap - Mapping 1:1 Associations Procedure: Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

19 Rmap – Mapping External Uniqueness Constraints Composite primary identifier, and functional fact type: Composite primary identifier and nonfunctional fact type: Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

20 Rmap – Mapping External Uniqueness Constraints Composite secondary identifier and functional fact type: External uniqueness constraint involving an m:n fact type: Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

21 Rmap – Mapping Objectified Associations Initially treat the objectified association as a “black box” (i.e. remove its identification scheme) Group fact types in the usual way Unpack ”the black box” into its component attributes Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

22 Rmap – Mapping Subtypes Subtyping mapping: –Absorption: absorb the subtypes back into the (top) supertype (giving qualified optional roles), group the fact types as usual, and then add the subtyping constraints as textual qualifications –Separation: separate tables for facts with subtype specific functional roles –Partition: may be used when the subtypes form a partition of their supertype Subtype constraints on functional roles map to qualified optionals: Nonfunctional fact type of subtypes map to separate tables: Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

23 Basic Rmap procedure Material on this slide based on Ch 11.3 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition

24 Resources Chapter 11 in Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition (ISBN: ), published by Morgan Kaufmann Publishers.

25 Next lecture #TitleDate 1Introduction ORM modeling Relational modeling ER modeling OO modeling Process modeling Service modeling Exam

26 Questions?