3 - Relational Data Model
3 - Relational Data Model
Model
Relational Data Model
§ Represent data in the form of
tables
§ A named, two-dimensional table
is called a relation
§ Each relation consists of named
columns and an arbitrary number
of unnamed rows
§ A named column is called an
attribute
§ Each row of a relation
corresponds to a record that
contains data
An attribute is characteristic or property of an entity
Classification of Attributes
§ Required vs. Optional Attributes
§ Simple vs. Composite Attributes
§ Single-valued vs. Multivalued Attributes
§ Stored vs. Derived Attributes
§ Identifier
4
Classification of Attributes
§ Required vs. Optional
Attributes
5
Classification of Attributes
Composite
§ Required vs. Optional Attributes
NAME
§ Simple vs. Composite
Attributes
LAST NAME FIRST NAME MID NAME
6
Single-valued–attribute
Classification of Attributes which has only one value
Multivalued–attribute that
§ Required vs. Optional Attributes may take on more than one
§ Simple vs. Composite Attributes value
§ Single-valued vs. Multivalued
Attributes
Single-Valued MultiValued
StudentID STudName BirthDate ContactNo
2019-1234 Julia Cruz 12/02/2005 0917-1111112
8900-7899
0933-7654321
7
Stored–value is provided by user
Classification of Attributes
Derived–value is computed or
§ Required vs. Optional Attributes derived from another attribute/s
§ Simple vs. Composite Attributes
§ Single-valued vs. Multivalued
Attributes
§ Stored vs. Derived Attributes
Stored Derived
StudentID STudName BirthDate Age
2019-1234 Julia Cruz 12/02/2005 15
8
Classification of Attributes Characteristics of
Identifiers
§ Required vs. Optional Attributes §Must not change in value
§ Simple vs. Composite Attributes §Must not be null
§ Single-valued vs. Multivalued §Must be unique
Attributes
§ Stored vs. Derived Attributes
§ Identifier
9
First Mid
Surname
Name Name
Commission Rate
CreditLImit Balance
RepNum
Street FirstName
City Street
LastName CustomerName
City
State
State Rep RepNum
Customer CustomerNum
Zip
Zip
OrderDate
CustomerNum OrderNum
Onhand
Order
Class Description
Price
PartNum
Warehouse Part
NumOrdered PartNum
QuotedPrice OrderNum
m
OrderLine
§ Domain Constraints
§ Entity Integrity
§ Referential Integrity
Integrity Constraints
The rule states that if there is a foreign key, either each foreign
key value must match a primary key value or the foreign key
value must be null
Foreign Key
Employee Address
Primary Key Emp_ID Emp_Name Age Emp_Add Primary Key Emp_Add City
1 Snowhite 18 A A Quezon
2 Belle 16 B B Makati
3 Mulan 17 C
4 Elsa 15 D D Manila
Integrity Constraints
Key Constraints are the entity set that is used to identify an entity
within its entity set uniquely
A entity set can have multiple keys but out of which one will be the
primary key. A primary key can contain a unique and null value in the
relation\table
Emp_ID
101
102
103
104
102 Not allowed because all rows must be unique
Source: