Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

6/12/2014

Definition
Data Models  An integrated collection of concepts for
describing and manipulating data,
relationships between data and
constraints on the data in an organisation.
•The role of Data Model
 A model is a representation of real world
•Hierarchical Model
objects and events and their associations.
•Network Model
•Relational Model  It represents the organisation itself.

Components Of Data Model Components Of Data Model


 Structural Part  Set of integrity rules.
Consists of a set of rules according to These ensures that the data is
which a database can be constructed. accurate
 Manipulative Part
Defines the type of operations that are
allowed on the dat(updating,retrieving
data etc)

The role of a data model Data Model Categories


 To make it easier to understand the  Object Based, Record Based, Physical
meaning of the data ie  The first two are used to describe data
 each user’s perspective of the data at the conceptual and external levels.
 The nature of the data  The later at the internal level, it
 The use of the data across user views describes details of how data is stored
 It is used to design a database in the computer

1
6/12/2014

Hierarchical Data Model


Record Based
 There are three types.  Data is represented in tree like structure
 Relational Data Model  Records appear as nodes or segments
 Network Data Model  It allows segments to have only one parent
 Hierarchical Data Model  The parent is sometimes known as the root
 The relationship between records is
represented by sets which are implemented
as pointers

Network Data Model


Hierarchical Data Model
 Access to a record is through a  This model is similar to the hierarchical
parent record. model.
 It allows segments to have more than
Purchase
one parent

Order Order-Item

example Object Based


 Object Oriented Data Model (Details in
Course1 Course 2 Course 3 Future Lectures)

Student 2
Student 3 Student 4

2
6/12/2014

Relational model

 Data are organized in two-dimensional tables


called relations.
 The tables are related to each other.
RELATIONAL
MODEL

Introduction to Relational Introduction to Relational


Databases Databases cont:
 The relational approach was originally
proposed in 1970’s .
 The model was proposed as a disciplined
 The first project that proved the way of handling data using the rigour of
practicality of the relational model is mathematics, particularly set theory.
System R, developed at IBM’s San Jose
 This would enhance the concept of
Research Laboratory in 1976. examples
program-data independence
oracle, Sybase, access
 and improve programmer activities.

Introduction to Relational Relational Data structure


Databases cont:
 The relational model will have only  The Relational approach is based on
values. elementary mathematical relation
 Even references between data in theory.
different sets (relations) are  Its basic construct is a relation. A
represented by means of values. relation is also called a table.
 In the hierarchical and network model  The data is organized in tables. The
there are explicit references (pointers), table has columns and rows.
which make them more complicated.

3
6/12/2014

Relational Model Terminology Relational Model Terminology


 A relation is a table with columns and  Attribute is a named column of a
rows. relation.
 Only applies to logical structure of the  Domain is the set of allowable values
database, not the physical structure. for one or more attributes.
 This doesn’t mean that data are stored as
tables; the physical storage of the data is
independent of the way the data are
logically organized.

Relational Model Terminology


Cont: Instances of Courses table
 Tuple is a row of a relation.
 Degree is the number of attributes in a
relation.
 Cardinality is the number of tuples in a
relation.
 Relational Database is a collection of
normalized relations with distinct
relation names.

Examples of Attribute Domains Alternative Terminology for


Relational Model

4
6/12/2014

Database Relations Properties of Relations


 Relation schema  Relation name is distinct from all other
 Named relation defined by a set of relation names in relational schema.
attribute and domain name pairs.  Each cell of relation contains exactly
 Relational database schema one atomic (single) value.
 Set of relation schemas, each with a  Each attribute has a distinct name.
distinct name.
 Values of an attribute are all from the
same domain.

Properties of Relations Relational Keys


 Each tuple is distinct; there are no  Superkey
An attribute, or a set of attributes, that uniquely
duplicate tuples. 
identifies a tuple within a relation.
 Order of attributes has no significance.  Candidate Key
 Order of tuples has no significance,  Superkey (K) such that no proper subset is a
superkey within the relation.
theoretically.  In each tuple of R, values of K uniquely identify
that tuple (uniqueness).
 No proper subset of K has the uniqueness
property (irreducibility).

Relational Keys Relational Integrity


 Primary Key  Null
 Candidate key selected to identify tuples uniquely
within relation.
 Represents value for an attribute that is
currently unknown or not applicable for
 Alternate Keys
tuple
 Candidate keys that are not selected to be primary
key.  Deals with incomplete or exceptional data.
 Foreign Key  Represents the absence of a value and is
 Attribute, or set of attributes, within one relation that not the same as zero or spaces, which are
matches candidate key of some (possibly same)
relation.
values.

5
6/12/2014

Relational Integrity Relational Integrity


 Entity Integrity  Enterprise Constraints
 In a base relation, no attribute of a primary  Additional rules specified by users or
key can be null. database administrators.
 Referential Integrity
 If foreign key exists in a relation, either
foreign key value must match a candidate key
value of some tuple in its home relation or
foreign key value must be wholly null.

You might also like