Fundamentals of database system - Relational data model and relational database constraints
1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4:...
Transcript of 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4:...
![Page 1: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/1.jpg)
Relational Database Concepts
1 © 2011 IBMCorporation
IBM Information Management Cloud Computing Center of Competence IBM Canada Labs
![Page 2: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/2.jpg)
• Overview
• Information and Data Models
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
2 © 2011 IBMCorporation
Agenda
![Page 3: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/3.jpg)
• Reading materials
• Database Fundamentals eBook
3 © 2011 IBMCorporation
•
•
•
•
Chapter 1: Databases and information models
Chapter 2: The relational data model
Chapter 3: The conceptual data model (optional)
Chapter 4: Relational database design (optional)
Supporting reading material
![Page 4: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/4.jpg)
• Overview
• Information and Data Models
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
4 © 2011 IBMCorporation
![Page 5: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/5.jpg)
Data vs. Information
• Data: Collection of letters, numbers or facts
• Information: Processed data that provides value
5 © 2011 IBMCorporation
![Page 6: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/6.jpg)
Databases and DBMS
6 © 2011 IBMCorporation
• Databases
• A repository of data
• DBMS (Database management system)
• Software system that manages databases
• The terms “Database”, “DBMS”, “data server”, “database
server” often used interchangeably to refer to a DBMS
• Why a DBMS?
• Security
• Can handle many users with good performance
• Allows for concurrency while keeping data consistent
• Protects from disaster
![Page 7: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/7.jpg)
• Overview
• Information and Data Models
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
7 © 2011 IBMCorporation
![Page 8: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/8.jpg)
Information and Data Models
Relationship between an Information Model and a Data Model
8 © 2011 IBMCorporation
![Page 9: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/9.jpg)
Data Models
9 © 2011 IBMCorporation
• Network
• Hierarchical
• Relational
• Entity-Relationship
• Extended relational
• Semantic
• Object-oriented
• Object-relational
• Semi-structured
![Page 10: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/10.jpg)
• Overview
• Information and Data Models
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
10 © 2011 IBMCorporation
![Page 11: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/11.jpg)
Relational Model
11 © 2011 IBMCorporation
![Page 12: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/12.jpg)
Entity-Relationship Diagrams
• Building Blocks
• Entities
• Attributes
Entity
Attribute
12 © 2011 IBMCorporation
![Page 13: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/13.jpg)
Entity and Attributes
13 © 2011 IBMCorporation
![Page 14: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/14.jpg)
ER diagram
Book
Title
ISBN
Editon
Year
PricePages
14 © 2011 IBMCorporation
Aisle
Description
![Page 15: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/15.jpg)
Exercise: Identify entities and attributes
15 © 2011 IBMCorporation
House
ComputerSocial Security Number
Height Order #
Product
Date
Phone #
![Page 16: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/16.jpg)
Did you get them right?
House
Date
ComputerSocial Security Number
Height Order #
Product
Phone #
16 © 2011 IBMCorporation
![Page 17: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/17.jpg)
• Overview
• Entity-relationship diagrams
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
17 © 2011 IBMCorporation
![Page 18: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/18.jpg)
Relationships
• Building Blocks
– Entity sets
– Relationship sets
– Crows Foot notations
18 © 2011 IBMCorporation
![Page 19: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/19.jpg)
ERD of Book
Book
Title
ISBN
Editon
Year
PricePages
19 © 2011 IBMCorporation
Aisle
Description
![Page 20: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/20.jpg)
ERD of Author
Author
Author_Id
City
Lastname
Firstname
Country
20 © 2011 IBMCorporation
![Page 21: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/21.jpg)
Example 1
21 © 2011 IBMCorporation
![Page 22: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/22.jpg)
Example 2
22 © 2011 IBMCorporation
![Page 23: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/23.jpg)
One-to-one Relationship
Book Authored By Author
Types of Relationships
23 © 2011 IBMCorporation
![Page 24: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/24.jpg)
One-to-many Relationships
Book AuthorAuthored By
Types of Relationships (Continued)
24 © 2011 IBMCorporation
![Page 25: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/25.jpg)
Many-to-many Relationships
Book AuthorAuthored By
Types of Relationships (Continued)
25 © 2011 IBMCorporation
![Page 26: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/26.jpg)
• Overview
• Entity-relationship diagrams
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
26 © 2011 IBMCorporation
![Page 27: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/27.jpg)
ERD revisited
Book
Title
ISBN
Editon
Year
PricePages
27 © 2011 IBMCorporation
Aisle
Description
![Page 28: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/28.jpg)
Mapping entity to a table
Entity
Table
Book
Title
ISBN
Editon
Year
PricePages
Aisle
Description
Attributes
Columns
28 © 2011 IBMCorporation
![Page 29: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/29.jpg)
Mapping entity to a table (Continued)
29 © 2011 IBMCorporation
Title Edition Year Price ISBN Pages Aisle Description
Database 1 2010 24.99 978-0- 300 DB- Teaches you
Fundamentals 98662 A02 the
83-1-1 fundamentals
of databases
Getting started 1 2010 24.99 978-0- 280 DB- Teaches you
with DB2 98662 A01 the essentials
Express-C 83-5-1 of DB2 using
DB2 Express-
C, the free
version of
DB2
Table: Book
![Page 30: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/30.jpg)
Mapping entity to a table (Continued)
30 © 2011 IBMCorporation
Author_ID Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilva nia
RO
Table: Author
![Page 31: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/31.jpg)
• Overview
• Entity-relationship diagrams
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
31 © 2011 IBMCorporation
![Page 32: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/32.jpg)
Relational Model Concepts
32 © 2011 IBMCorporation
• Building Blocks
• Relation
• Sets
Dr. E.F. Codd of IBM in 1970:
“A Relational Model for Large Shared Data Banks”
![Page 33: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/33.jpg)
A Relational Database
33 © 2011 IBMCorporation
• RelationalDatabase
• Relation
• Relation Schema
• Relation Instance
![Page 34: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/34.jpg)
A Relation
TUPLES
Author_ ID
Lastname Firstna me
Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
ATTRIBUTES
DEGREE=6
CARDINALITY=5
AUTHOR(Author_ID: char, lastname: varchar, firstname: varchar,
email: varchar, city: varchar, country: char)
34 © 2011 IBMCorporation
Relation
Schema
Relation Instance
A DOMAIN is the set of all possible values for a specific attribute
![Page 35: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/35.jpg)
• Overview
• Entity-relationship diagrams
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
35 © 2011 IBMCorporation
![Page 36: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/36.jpg)
Relational Model Constraints
Business Rules
Book Authored By Author
Referencing
Data Integrity
36 © 2011 IBMCorporation
![Page 37: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/37.jpg)
ERD representation of a Relational Data Model
Primary Key
Foreign Key
Parent Table
Dependant Table
37 © 2011 IBMCorporation
![Page 38: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/38.jpg)
Constraints
38 © 2011 IBMCorporation
• Entity Integrity Constraint
• Referential Integrity Constraint
• Semantic Integrity Constraint
• Domain Constraint
• Null Constraint
• Check Constraint
![Page 39: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/39.jpg)
Entity Integrity Constraint
39 © 2011 IBMCorporation
Author_ID
[PK]Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
![Page 40: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/40.jpg)
Entity Integrity Constraint
Author_ID
[PK]Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
40 © 2011 IBMCorporation
![Page 41: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/41.jpg)
Entity Integrity Constraint
A1
AUTHOR
Author_ID
[PK]Lastname Firstname Email City Country
NULL Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
41 © 2011 IBMCorporation
![Page 42: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/42.jpg)
Entity Integrity Constraint
A1
A4
AUTHOR
Author_ID
[PK]Lastname Firstname Email City Country
NULL Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
NULL Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
42 © 2011 IBMCorporation
![Page 43: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/43.jpg)
Referential Integrity Constraint
Book Authored By Author
Referencing
43 © 2011 IBMCorporation
![Page 44: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/44.jpg)
Semantic Integrity Constraint
44 © 2011 IBMCorporation
Author_ID
[PK]Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
![Page 45: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/45.jpg)
Semantic Integrity Constraint
Toronto
Author_ID
[PK]Lastname Firstname Email City Country
A1 Chong Raul [email protected] 12(*)&^23 CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
45 © 2011 IBMCorporation
AUTHOR
![Page 46: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/46.jpg)
Domain Constraint
46 © 2011 IBMCorporation
Author_ID Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
![Page 47: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/47.jpg)
Domain Constraint
CA
CA
CA
Author_ID Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto 34
A2 Ahuja Rav [email protected] Toronto 34
A3 Hakes Ian [email protected] Toronto 34
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
47 © 2011 IBMCorporation
![Page 48: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/48.jpg)
NULL Constraint
48 © 2011 IBMCorporation
Author_ID Lastname Firstname Email City Country
A1 Chong Raul [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 Hakes Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
AUTHOR
![Page 49: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/49.jpg)
NULL Constraint
Raul
Hakes
Author_ID Lastname Firstname Email City Country
A1 Chong NULL [email protected] Toronto CA
A2 Ahuja Rav [email protected] Toronto CA
A3 NULL Ian [email protected] Toronto CA
A4 Sharma Neeraj [email protected] Chennai IN
A5 Perniu Liviu [email protected] Transilvania RO
49 © 2011 IBMCorporation
AUTHOR
![Page 50: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/50.jpg)
Check Constraint
50 © 2011 IBMCorporation
Title Edition Year Price ISBN Pages Aisle Description
Database 1 2010 24.99 978-0- 300 DB- Teaches you
Fundamentals 98662 A02 the
83-1-1 fundamentals
of databases
Getting started 1 2010 24.99 978-0- 280 DB- Teaches you
with DB2 98662 A01 the essentials
Express-C 83-5-1 of DB2 using
DB2 Express-
C, the free
version of
DB2
BOOK
![Page 51: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/51.jpg)
Check Constraint
2010
Title Edition Year Price ISBN Pages Aisle Description
Database 1 2010 24.99 978-0- 300 DB- Teaches you
Fundamentals 98662 A02 the
83-1-1 fundamentals
of databases
Getting started with DB2
1 2015 24.99 978-0-
98662280 DB-
A01Teaches you the essentials
Express-C 83-5-1 of DB2 using
DB2 Express-
C, the free
version of
DB2
51 © 2011 IBMCorporation
BOOK
![Page 52: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/52.jpg)
• Overview
• Entity-relationship diagrams
• The relational model
• Entity-Relationship diagrams
• Types of relationships
• Mapping entities to tables
• Relational model concepts
• Relational model constraints
• Normalization
Agenda
52 © 2011 IBMCorporation
![Page 53: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/53.jpg)
Normalization
■ Process in database design to remove redundancies
■ Example:
Consider the following table listing all the tasks of an employee:
Problem:
If John moves to a new city, all entries related to John must be updated
53 © 2011 IBMCorporation
![Page 54: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/54.jpg)
Normalization (continued)
No redundancy, no anomalies, no loss of information
54 © 2011 IBMCorporation
![Page 55: 1.1 - Relational database conceptsmetalab.uniten.edu.my/~alancheah/CISB314/Lab 1/Lab 1...Chapter 4: Relational database design (optional) Supporting reading material •Overview •Information](https://reader030.fdocuments.net/reader030/viewer/2022040300/5e6b19b5647a5d7bf7355978/html5/thumbnails/55.jpg)
55 © 2011 IBMCorporation
Thank you!