Docsity

Understanding Relational Data Model: Concepts, Characteristics, and E-R Model as Relations, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Understanding Relational Data Model: Concepts, Characteristics, and E-R Model as Relations and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Chapter 5

The Relational Data Model

Relational Model Concepts

  • The Relational Model of Data is based on

the concept of a Relation

  • A Relation is a two-dimensional table
    • The columns of the table represent attributes
    • The rows of the table represent entities

Model Concepts

  • Domain D is a set of atomic values
    • Atomic means that each value is indivisible
  • Attribute A is the name of a role played by some

domain

  • Relation schema R is the specification of a

relation

  • Given by a name and list of attributes
  • Degree of a relation is the number of attributes
  • Relation (instance) r(R) of a relation schema
  • A set of n-tuples, n is degree of relation schema

Characteristics of Relational Model

  • Relation is a set of tuples
    • No ordering of tuples
    • No duplicate tuples
      • no two rows have all the same values
  • Each attribute value is atomic
    • So no multiple-valued or composite attributes
    • called first normal form
  • Each relation is a set of assertions
    • Each represents a fact
    • Some facts are about relationships

Example of Relation Schema and Table

  • Figure 4.2 P
    • Customer(accountID,lastName,firstName, street, city,
state, zipcode, balance)

account Id

lastNa me

firstNa me

street city stat e

zipcod e

balan ce

101 Block Jane 1010 Main St.

Apopk a

FL 30458 0.

102 Hamilt on

Cherry 3230 Dade St.

Dade City

FL 30555 4.

103 Harriso n

Kate 103 Dodd Hall

Apopk a

FL 30457 30.

104 Breaux Carroll 76 Main St.

Apopk a

FL 30458 34.

Attributes are atomic

  • Composite attributes
    • simple attribute for each field
    • Customer (accountId, lastName, firstName,

street, city, state, zipcode)

  • Multi-valued Attributes
    • Represent as Tables
    • See Figure 4.

Representing Relationships as Attributes

  • One-to-many
    • For each one-to-many relationship type R
      • subject class S (one side)
      • target class T (many side)
    • Add the key attributes of S to the schema of T
      • as foreign keys
    • Name the foreign key attributes
      • ues the role that S plays in relationship type R
    • Add the attributes of the relationship type R to
schema for T
  • One-to-one
    • choose one side and use above rule

Representing Relationships as Tables

  • Create a relation schema for the

relationship type

  • foreign key attributes for the key of the

related schema

  • add attributes of the relationship type