Professional Documents
Culture Documents
1.1 - Relational Database Concepts
1.1 - Relational Database Concepts
1.1 - Relational Database Concepts
IBM Information Management Cloud Computing Center of Competence IBM Canada Labs
1
2011 IBM Corporation
Agenda
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
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
Data:
Agenda
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
Data Models Network Hierarchical Relational Entity-Relationship Extended relational Semantic Object-oriented Object-relational Semi-structured
Agenda
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
10
Relational Model
11
Entity-Relationship Diagrams
Attribute
12
13
ER diagram
Aisle
Book
Year
14
Phone # Computer
Order #
2011 IBM Corporation
Phone # Computer
Order #
2011 IBM Corporation
Agenda
Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization
17
Relationships
Building Blocks
Entity sets Relationship sets Crows Foot notations
18
ERD of Book
Aisle
Book
Year
19
ERD of Author
Author_Id
Lastname
Country
Author
Firstname
City
20
Example 1
21
Example 2
22
Types of Relationships
Book
Authored By
Author
One-to-one Relationship
23
Book
Authored By
Author
One-to-many Relationships
24
Book
Authored By
Author
Many-to-many Relationships
25
Agenda
Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization
26
ERD revisited
Title Description Editon
Aisle
Book
Year
27
Aisle Pages
Attributes
ISBN Price
Year
Columns
28
2011 IBM Corporation
Table: Book
Title Database Fundamentals Edition 1 Year 2010 Price 24.99 ISBN Pages Aisle DBA02 Description Teaches you the fundamentals of databases Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 978-0- 300 98662 83-1-1 978-0- 280 98662 83-5-1
2010
24.99
DBA01
29
Table: Author
Author_ID A1 A2 A3 A4 A5 Lastname Chong Ahuja Hakes Sharma Perniu Firstname Raul Rav Ian Neeraj Liviu Email rfc@ibm.com ra@ibm.com ih@ibm.com ns@ibm.com lp@univ.com City Toronto Toronto Toronto Chennai Country CA CA CA IN
Transilva RO nia
30
Agenda
Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization
31
Dr. E.F. Codd of IBM in 1970: A Relational Model for Large Shared Data Banks
32
A Relational Database
Relational Database
Relation
Relation Schema Relation Instance
33
A Relation
AUTHOR(Author_ID: char, lastname: varchar, firstname: varchar, email: varchar, city: varchar, country: char)
Relation Schema
Relation Instance
DEGREE=6 CARDINALITY=5
Author_ ID Lastname
ATTRIBUTES
Firstna me
City
Country
A1 A2
CA
CA CA IN RO
TUPLES
A3 A4 A5
Agenda
Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization
35
Author
Referencing
Data Integrity
36
2011 IBM Corporation
Foreign Key
37
Constraints
Entity Integrity Constraint Referential Integrity Constraint Semantic Integrity Constraint Domain Constraint Null Constraint Check Constraint
38
AUTHOR
Author_ID [PK] A1 A2 A3 A4 A5 Lastname Firstname Email City Country
CA CA CA IN RO
39
AUTHOR
Author_ID [PK] A1 A2 A3 A4 A5 Lastname Firstname Email City Country
CA CA CA IN RO
40
AUTHOR
Author_ID [PK] A1 NULL A2 A3 A4 A5 Lastname Firstname Email City Country
CA CA CA IN RO
41
AUTHOR
Author_ID [PK] A1 NULL A2 A3 A4 NULL A5 Lastname Firstname Email City Country
CA CA CA IN RO
42
Book
Authored By
Author
Referencing
43
CA CA CA IN RO
44
Toronto 12(*)&^23
Toronto Toronto Chennai Transilvania
CA CA CA IN RO
45
Domain Constraint
AUTHOR
Author_ID Lastname Firstname Email City Country
A1 A2 A3 A4 A5
CA CA CA
IN RO
46
Domain Constraint
AUTHOR
Author_ID Lastname Firstname Email City Country
A1 A2 A3 A4 A5
CA 34 CA
34
CA 34
IN RO
47
NULL Constraint
AUTHOR
Author_ID Lastname Firstname Email City Country
A1 A2 A3 A4 A5
CA CA CA IN RO
48
NULL Constraint
AUTHOR
Author_ID Lastname Firstname Email City Country
A1 A2 A3 A4 A5
CA CA CA IN RO
49
Check Constraint
BOOK
Title Database Fundamentals Edition 1 Year 2010 Price 24.99 ISBN Pages Aisle DBA02 Description Teaches you the fundamentals of databases Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 978-0- 300 98662 83-1-1 978-0- 280 98662 83-5-1
2010
24.99
DBA01
50
Check Constraint
BOOK
Title Database Fundamentals Edition 1 Year 2010 Price 24.99 ISBN Pages Aisle DBA02 Description Teaches you the fundamentals of databases Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 978-0- 300 98662 83-1-1 978-0- 280 98662 83-5-1
DBA01
51
Agenda
Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization
52
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 IBM Corporation
Normalization (continued)
No redundancy, no anomalies, no loss of information
54
Thank you!
55
2011 IBM Corporation