Your SlideShare is downloading. ×
0
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
9 relational database concepts
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

9 relational database concepts

3,279

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,279
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
81
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Relational Database Concepts IBM Information Management Cloud Computing Center of Competence IBM Canada Labs 1 © 2011 IBM Corporation
  • 2. 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 2 © 2011 IBM Corporation
  • 3. Supporting reading material & videos • 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 3 © 2011 IBM Corporation
  • 4. 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 4 © 2011 IBM Corporation
  • 5. Data vs. Information • Data: Collection of letters, numbers or facts • Information: Processed data that provides value 5 © 2011 IBM Corporation
  • 6. 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 6 © 2011 IBM Corporation
  • 7. 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 7 © 2011 IBM Corporation
  • 8. Information and Data Models Relationship between an Information Model and a Data Model 8 © 2011 IBM Corporation
  • 9. Data Models • Network • Semantic • Hierarchical • Object-oriented • Relational • Object-relational • Entity-Relationship • Semi-structured • Extended relational 9 © 2011 IBM Corporation
  • 10. 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 © 2011 IBM Corporation
  • 11. Relational Model 11 © 2011 IBM Corporation
  • 12. Entity-Relationship Diagrams • Building Blocks • Entities • Attributes 12 Entity Attribute © 2011 IBM Corporation
  • 13. Entity and Attributes 13 © 2011 IBM Corporation
  • 14. ER diagram Title Description Aisle Editon Book Year Pages ISBN 14 Price © 2011 IBM Corporation
  • 15. Exercise: Identify entities and attributes House Phone # Social Security Number Computer Product Date Height 15 Order # © 2011 IBM Corporation
  • 16. Did you get them right? House Phone # Social Security Number Computer Product Date Height 16 Order # © 2011 IBM Corporation
  • 17. 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 © 2011 IBM Corporation
  • 18. Relationships • Building Blocks – Entity sets – Relationship sets – Crows Foot notations 18 © 2011 IBM Corporation
  • 19. ERD of Book Title Description Aisle Editon Book Year Pages ISBN 19 Price © 2011 IBM Corporation
  • 20. ERD of Author Lastname Author_Id Author Country City 20 Firstname Email © 2011 IBM Corporation
  • 21. Example 1 21 © 2011 IBM Corporation
  • 22. Example 2 22 © 2011 IBM Corporation
  • 23. Types of Relationships Book Authored By Author One-to-one Relationship 23 © 2011 IBM Corporation
  • 24. Types of Relationships (Continued) Book Authored By Author One-to-many Relationships 24 © 2011 IBM Corporation
  • 25. Types of Relationships (Continued) Book Authored By Author Many-to-many Relationships 25 © 2011 IBM Corporation
  • 26. 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 © 2011 IBM Corporation
  • 27. ERD revisited Title Description Aisle Editon Book Year Pages ISBN 27 Price © 2011 IBM Corporation
  • 28. Mapping entity to a table Entity Book Description Aisle Pages Table Title Editon Attributes ISBN Year Price Columns 28 © 2011 IBM Corporation
  • 29. Mapping entity to a table (Continued) Table: Book Title Edition Year Price ISBN Database Fundamentals 1 2010 24.99 978-0- 300 98662 83-1-1 DBA02 Teaches you the fundamentals of databases Getting started 1 with DB2 Express-C 2010 24.99 978-0- 280 98662 83-5-1 DBA01 Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 29 Pages Aisle Description © 2011 IBM Corporation
  • 30. Mapping entity to a table (Continued) Table: Author Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilva RO nia 30 © 2011 IBM Corporation
  • 31. 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 © 2011 IBM Corporation
  • 32. Relational Model Concepts Dr. E.F. Codd of IBM in 1970: “A Relational Model for Large Shared Data Banks” • Building Blocks • Relation • Sets 32 © 2011 IBM Corporation
  • 33. A Relational Database • Relational Database • Relation • Relation Schema • Relation Instance 33 © 2011 IBM Corporation
  • 34. A Relation AUTHOR(Author_ID: char, lastname: varchar, firstname: varchar, email: varchar, city: varchar, country: char) Relation Instance DEGREE=6 CARDINALITY=5 Relation Schema ATTRIBUTES Lastname Firstna me Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 TUPLES Author_ ID Perniu Liviu lp@univ.com Transilvania RO A DOMAIN is the set of all possible values for a specific attribute 34 © 2011 IBM Corporation
  • 35. 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 © 2011 IBM Corporation
  • 36. Relational Model Constraints Business Rules Book Authored By Author Referencing Data Integrity 36 © 2011 IBM Corporation
  • 37. ERD representation of a Relational Data Model Primary Key Parent Table Dependant Table 37 Foreign Key © 2011 IBM Corporation
  • 38. Constraints • Entity Integrity Constraint • Referential Integrity Constraint • Semantic Integrity Constraint • Domain Constraint • Null Constraint • Check Constraint 38 © 2011 IBM Corporation
  • 39. Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 39 © 2011 IBM Corporation
  • 40. Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 40 © 2011 IBM Corporation
  • 41. Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 NULL Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 41 © 2011 IBM Corporation
  • 42. Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 NULL Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 NULL Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 42 © 2011 IBM Corporation
  • 43. Referential Integrity Constraint Book Authored By Author Referencing 43 © 2011 IBM Corporation
  • 44. Semantic Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 44 © 2011 IBM Corporation
  • 45. Semantic Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto 12(*)&^23 CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 45 © 2011 IBM Corporation
  • 46. Domain Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 46 © 2011 IBM Corporation
  • 47. Domain Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA 34 A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA 34 A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 47 34 © 2011 IBM Corporation
  • 48. NULL Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 48 © 2011 IBM Corporation
  • 49. NULL Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul NULL rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes NULL Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 49 © 2011 IBM Corporation
  • 50. Check Constraint BOOK Title Edition Year Price ISBN Database Fundamentals 1 2010 24.99 978-0- 300 98662 83-1-1 DBA02 Teaches you the fundamentals of databases Getting started 1 with DB2 Express-C 2010 24.99 978-0- 280 98662 83-5-1 DBA01 Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 50 Pages Aisle Description © 2011 IBM Corporation
  • 51. Check Constraint BOOK Title Edition Year Price ISBN Database Fundamentals 1 2010 24.99 978-0- 300 98662 83-1-1 DBA02 Teaches you the fundamentals of databases 2010 24.99 2015 978-0- 280 98662 83-5-1 DBA01 Teaches you the essentials of DB2 using DB2 ExpressC, the free version of DB2 Getting started 1 with DB2 Express-C 51 Pages Aisle Description © 2011 IBM Corporation
  • 52. 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 © 2011 IBM Corporation
  • 53. 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
  • 54. Normalization (continued) No redundancy, no anomalies, no loss of information 54 © 2011 IBM Corporation
  • 55. Thank you! 55 © 2011 IBM Corporation

×