55
1 © 2011 IBM Corporation Relational Database Concepts IBM Information Management Cloud Computing Center of Competence IBM Canada Labs

IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul [email protected]

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

1 © 2011 IBM Corporation

Relational Database Concepts

IBM Information Management Cloud Computing Center of CompetenceIBM Canada Labs

Page 2: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

2 © 2011 IBM Corporation

• 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

Page 3: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

3 © 2011 IBM Corporation

• Reading materials• Database Fundamentals eBook

• 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)

• Videos• db2university.com course AA001EN

• Lesson 1: Relational database concepts

Supporting reading material & videos

Page 4: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

4 © 2011 IBM Corporation

• 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

Page 5: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

5 © 2011 IBM Corporation

Data vs. Information

• Data: Collection of letters, numbers or facts

• Information: Processed data that provides value

Page 6: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

6 © 2011 IBM Corporation

Databases and DBMS• 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: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

7 © 2011 IBM Corporation

• 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

Page 8: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

8 © 2011 IBM Corporation

Information and Data Models

Relationship between an Information Model and a Data Model

Page 9: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

9 © 2011 IBM Corporation

Data Models

• Network

• Hierarchical

• Relational

• Entity-Relationship

• Extended relational

• Semantic

• Object-oriented

• Object-relational

• Semi-structured

Page 10: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

10 © 2011 IBM Corporation

• 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

Page 11: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

11 © 2011 IBM Corporation

Relational Model

Page 12: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

12 © 2011 IBM Corporation

Entity-Relationship Diagrams

• Building Blocks

• Entities

• Attributes

Entity

Attribute

Page 13: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

13 © 2011 IBM Corporation

Entity and Attributes

Page 14: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

14 © 2011 IBM Corporation

ER diagram

Book

Title

ISBN

Editon

Year

PricePages

Aisle

Description

Page 15: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

15 © 2011 IBM Corporation

Exercise: Identify entities and attributes

House

Date

ComputerSocial Security Number

Height Order #

Product

Phone #

Page 16: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

16 © 2011 IBM Corporation

Did you get them right?

House

Date

ComputerSocial Security Number

Height Order #

Product

Phone #

Page 17: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

17 © 2011 IBM Corporation

• 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

Page 18: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

18 © 2011 IBM Corporation

Relationships

• Building Blocks

– Entity sets

– Relationship sets

– Crows Foot notations

Page 19: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

19 © 2011 IBM Corporation

ERD of Book

Book

Title

ISBN

Editon

Year

PricePages

Aisle

Description

Page 20: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

20 © 2011 IBM Corporation

ERD of Author

Author

Author_Id

City

Lastname

Firstname

Email

Country

Page 21: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

21 © 2011 IBM Corporation

Example 1

Page 22: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

22 © 2011 IBM Corporation

Example 2

Page 23: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

23 © 2011 IBM Corporation

One-to-one Relationship

Book AuthorAuthored By

Types of Relationships

Page 24: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

24 © 2011 IBM Corporation

One-to-many Relationships

Book AuthorAuthored By

Types of Relationships (Continued)

Page 25: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

25 © 2011 IBM Corporation

Many-to-many Relationships

Book AuthorAuthored By

Types of Relationships (Continued)

Page 26: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

26 © 2011 IBM Corporation

• 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

Page 27: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

27 © 2011 IBM Corporation

ERD revisited

Book

Title

ISBN

Editon

Year

PricePages

Aisle

Description

Page 28: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

28 © 2011 IBM Corporation

Mapping entity to a table

Entity

Table

Book

Title

ISBN

Editon

Year

PricePages

Aisle

Description

Attributes

Columns

Page 29: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

29 © 2011 IBM Corporation

Mapping entity to a table (Continued)

Title Edition Year Price ISBN Pages Aisle Description

Database Fundamentals

1 2010 24.99 978-0-9866283-1-1

300 DB-A02

Teaches you the fundamentals of databases

Getting started with DB2 Express-C

1 2010 24.99 978-0-9866283-5-1

280 DB-A01

Teaches you the essentials of DB2 using DB2 Express-C, the free version of DB2

Table: Book

Page 30: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

30 © 2011 IBM Corporation

Mapping entity to a table (Continued)

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

Table: Author

Page 31: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

31 © 2011 IBM Corporation

• 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

Page 32: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

32 © 2011 IBM Corporation

Relational Model Concepts

• Building Blocks

• Relation

• Sets

Dr. E.F. Codd of IBM in 1970: “A Relational Model for Large Shared Data Banks”

Page 33: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

33 © 2011 IBM Corporation

A Relational Database

•Relational Database

• Relation

• Relation Schema

• Relation Instance

Page 34: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

34 © 2011 IBM Corporation

A Relation

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

TUPLES

ATTRIBUTES

DEGREE=6CARDINALITY=5

AUTHOR(Author_ID: char, lastname: varchar, firstname: varchar, email: varchar, city: varchar, country: char)

Relation Schema

Relation Instance

A DOMAIN is the set of all possible values for a specific attribute

Page 35: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

35 © 2011 IBM Corporation

• 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

Page 36: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

36 © 2011 IBM Corporation

Relational Model Constraints

Business Rules

Book AuthorAuthored By

Referencing

Data Integrity

Page 37: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

37 © 2011 IBM Corporation

ERD representation of a Relational Data Model

Primary Key

Foreign Key

Parent TableDependant Table

Page 38: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

38 © 2011 IBM Corporation

Constraints

• Entity Integrity Constraint

• Referential Integrity Constraint

• Semantic Integrity Constraint

• Domain Constraint

• Null Constraint

• Check Constraint

Page 39: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

39 © 2011 IBM Corporation

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

Page 40: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

40 © 2011 IBM Corporation

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

Page 41: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

41 © 2011 IBM Corporation

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

NULL

Page 42: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

42 © 2011 IBM Corporation

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

NULL

NULL

Page 43: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

43 © 2011 IBM Corporation

Referential Integrity Constraint

Book AuthorAuthored By

Referencing

Page 44: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

44 © 2011 IBM Corporation

Semantic 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

Page 45: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

45 © 2011 IBM Corporation

Semantic 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

12(*)&^23

AUTHOR

Page 46: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

46 © 2011 IBM Corporation

Domain Constraint

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: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

47 © 2011 IBM Corporation

Domain Constraint

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

34

34

34

AUTHOR

Page 48: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

48 © 2011 IBM Corporation

NULL Constraint

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: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

49 © 2011 IBM Corporation

NULL Constraint

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

NULL

NULL

AUTHOR

Page 50: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

50 © 2011 IBM Corporation

Check Constraint

Title Edition Year Price ISBN Pages Aisle Description

Database Fundamentals

1 2010 24.99 978-0-9866283-1-1

300 DB-A02

Teaches you the fundamentals of databases

Getting started with DB2 Express-C

1 2010 24.99 978-0-9866283-5-1

280 DB-A01

Teaches you the essentials of DB2 using DB2 Express-C, the free version of DB2

BOOK

Page 51: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

51 © 2011 IBM Corporation

Check Constraint

Title Edition Year Price ISBN Pages Aisle Description

Database Fundamentals

1 2010 24.99 978-0-9866283-1-1

300 DB-A02

Teaches you the fundamentals of databases

Getting started with DB2 Express-C

1 2010 24.99 978-0-9866283-5-1

280 DB-A01

Teaches you the essentials of DB2 using DB2 Express-C, the free version of DB2

2015

BOOK

Page 52: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

52 © 2011 IBM Corporation

• 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

Page 53: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

53 © 2011 IBM Corporation

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

Page 54: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

54 © 2011 IBM Corporation

Normalization (continued)No redundancy, no anomalies, no loss of information

Page 55: IBM Information Management Cloud Computing Center of Competence IBM …myy.haaga-helia.fi/~dbms/db2/01_Classroom/1.1... · 2011. 5. 24. · Email City Country A1 Chong Raul rfc@ibm.com

55 © 2011 IBM Corporation

Thank you!