You are on page 1of 24

Introduction

 In E-R model, we have discussed the


importance of Data Model.
 E-R Modeling tool develops a Highly
Conceptual Model, which is essential to
understand the organization
 It is not sufficient to identify the
requirements for database development.
Introduction
 The Conceptual or Semantic Model must be

converted to a Logical Model.


 One of the Logical Database Model tools is

called Relational Model.


 It was introduced by E. F. Codd in 1970.

 The tool develops a Relational Model of from

the Conceptual Model.


Introduction
 A Relational Model of a part of the Real

World with set of relations.


 A Relational Schema is build using
Relational Model
Introduction
 The Relational Model of data permits the

Database Designer to create a Consistent,


Logical representation of Information.
Relational Model
Relation Model is used to create Relational

Schema.
A Relational Model uses 2 Dimensional
(Tabular Structure) to represent the Schema
where
 Columns represent Set of Attributes
 The Rows represent the Instances of the
Object.
Relational Model
An Instance of a Relational Schema is called

a Relation.
Relation
A Relation is a Two-Dimensional Table. It

identifies a set of instances of objects of the


Same Class using a Set of Attributes and
their Values.

A Relation is identified by a Name.


Example of a Relation

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 5- 8


Example
Employee Table

EID (PK) FName LName Department Manager

001 Vijay Kumar IT Support Vijay Kumar

002 Rama Raju Sales Rama Raju

003 Kumar Swamy Sales Rama Raju

004 Santhosh Kumar Marketing Santhosh Kumar

005 Rajesh Kanna Sales Rama Raju

006 Samuel Raju IT Support Vijay Kumar


Observation
Theoretically there is No Size Restriction. Any

Number of Employees and any Number of


Attributes can be included. Thus, the Size is
Limited by the available fact.
Basic Question
 How are Values Assigned to these Columns?

Why Vijay Kumar is under Name and not


under Age?
 How are Column Names such as Age,
Salary, etc. selected?
 How is a Relation Identified and Accessed?
Solution
 To Understand the Structure Of A Relation

and its Processing, we need to Define the


following terms
 Atomic Value  Relational Schema
 Attribute  Ordering of Tuples
 Tuple  Keys Constraint
 Degree of Relation
Atomic Value
A Value that cannot be divided into Smaller

Parts without losing its Meaning.

Example: SNO
Attribute
Name of a Column of a Relation

Example: Sage
Domain
A set of Atomic Values of an Attribute.

A Domain is identified by a Name.

 In order to create a proper domain for an

attribute we associate a type with it.


The domain of an attribute is written as Dom

( < Attribute name> ).


Tuples
A Row of a relation is called a Tuple.

A Tuple has Several Fields and the Total

Number of Fields in a Tuple is the same as


the Total Number of Columns in the relation.
Example

002 Rama Raju Sales Rama Raju


Degree of Relation
The number of columns (attributes) in a

relation.
 The degree of EMP is 5.

002 Rama Raju Sales Rama Raju

A Tuple of this relation is 5-tuple, where 5

indicates the Total Number of Attributes in a


schema.
Operations
on Relations
 Any Operation (Modify, Insert, Delete) on a
relation must satisfy some correctness
criteria before they are applied.
Operations on Relations
 These Correctness Criteria are called
Integrity Constraints. There are Three
Types:

1. Key constraints

2. Entity integrity constraints

3. Referential integrity constraints


Definition Summary
Informal Terms Formal Terms
Table Relation
Column Header Attribute
All possible Column Domain
Values
Row Tuple

Table Definition Schema of a Relation


Populated Table State of the Relation
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 5- 20
Key constraints
 A Key Attribute (Candidate or Primary)
cannot have more than one value in a
relational.
 Operations that may violate this constraint
are not allowed.
Entity Integrity
 The Value of a Primary Key or Candidate
Keys cannot be NULL.
Referential Integrity
 If Two Relations are Related via a Foreign
Key then
 if One Relation is modified then the Other
Related Relation must be modified
accordingly or the operation is not allowed.
Observation
 The Presence of these keys and constraints
makes the operation on a Relation Complex.

 These Constraints are not explicitly


expressed but implied in the Transactions
Code.

You might also like