Docsity

Relational Database Model - Database Management - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Relational Database Model - Database Management - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

The Relational Database Model:

Introduction

Docsity.com

Objectives

  • Explain why the relational database model became practical in about 1980.
  • Define such basic relational database terms as relation and tuple.
  • Describe the major types of keys including primary, candidate, and foreign.

Relational Database Model

  • In 1970, E. F. Codd published “A Relational Model of Data for Large Shared Data Banks” in CACM.
  • In the early 1980s, commercially viable relational database management systems became available.

Relational Database Model

  • While relational database was very tempting in concept in the 1970s, it was not easily applicable in a real-world environment for reasons related to performance.
  • The earlier hierarchical and network database management systems were just coming onto the commercial scene and were the focus of intense marketing efforts by the software and hardware vendors.

Relational Terminology

  • Relations - what we have been referring to as simple linear files. Also called tables.
  • Row = record (files) = tuple (relation)
  • Column = field (files) = attribute (relation)

Relational Database Terminology

Attribute(or Column or Field) Tuple (or Row orRecord)

Student Number Student Name Class Major 03657 Robert Shaw Senior Biology 05114 Gloria Stuart Freshman English 0595012746 Fred SimpsonW. Shin JuniorJunior MathematicsEnglish 15887 Pedro Marcos Senior History 19462 H. Yamato Sophomore French 21682 Mary Jones Freshman Chemistry 24276 Steven Baker Sophomore History

File / Relation: Differences

  • Every row/column position (a cell) can have only a single value, which is not necessarily true in a file.
  • No two rows of a relation are identical, which is not necessarily true in a file.

Primary Key

  • A relation always has a unique primary key.
  • A primary key (also called “the key”) is an attribute or a group of attributes whose values are unique throughout all of the rows of the relation.

Primary Key

  • The number of attributes involved in the primary key is always the minimum number of attributes that provide the uniqueness quality.
  • In the worst case, all of the relation’s attributes combined could serve as the primary key.

Candidate Key

  • If a relation has more than one attribute or minimum group of attributes that represents a way of uniquely identifying the entities, then they are each called a candidate key.
  • When there is more than one candidate key, one of them must be chosen to be the primary key of the relation.

Foreign Key

  • An attribute or group of attributes that serves as the primary key of one relation and also appears in another relation (foreign key in this relation).

Foreign Key

  • Crucial in relational database, because the foreign key is the mechanism that ties relations together to represent unary, binary, and ternary relationships.
  • Foreign key attribute must have same domain of values as Primary key attribute in other relation.

Binary Relationships

  • One-to-One
  • One-to-Many
  • Many-to-Many

One-to-Many Binary Relationship

  • The Salesperson Number foreign key in the CUSTOMER relation effectively establishes the one-to-many relationship between salespersons and customers.

5-

Salesperson Customer

Docsity.com