Data Models

advertisement
Data Models

SOURCE:
Fundamentals of Database Systems (6th Edition) by Ramez Elmasi, Shamkant B.
Navathe + Database System Concepts (English) 6th Edition by Abraham
Silberschatz , S. Sudarshan , Henry F. Korth + Freely Accessible Web Resources
Slide 1-1
Contents
Conceptual Data Model
 Representational Data Model
◦ Hierarchical Data Model
◦ Network Data Model
◦ Relational Data Model
◦ Object Oriented Data Model
◦ Object Relational Model
 Physical Data Model

Data Models

Data Model: A set of concepts to describe the structure of a
database, and certain constraints that the database should obey.
Data Model can be categorized as follow:
◦ Conceptual Data Model(High Level):
 Provides the concept that are close to the way many user
perceive the data.
 It describes concepts such as entities, attributes and
relationship.
Data Models(cont..)
◦ Representational Data Model:
 How data are implemented in Database like
Hierarchical Database model, Network data model,
Relational data model etc.
 Provides concept that may be understood by end users
and also how data is organized in computer storage
◦ Physical Data Model: Describe the details of how data is
stored in the computer. This type of concepts are
generally meant for computer specialist.
Slid
e 24
Hierarchical Model





A hierarchical database consists of a collection of records
which are connected to one another through links.
A record is a collection of fields, each of which contains only
one data value.
A link is an association between precisely two records.
The schema for a hierarchical database consists of
◦ boxes, which correspond to record types
◦ lines, which correspond to links
When transforming E-R diagrams to corresponding treestructure diagrams, we must ensure that the resulting
diagrams are in the form of rooted trees.
Hierarchical Model(cont..)
Transformation of ER Diagram to database

In the banking system, consider the customer-account relationship.

In the above ER Diagram:
◦ We have two types of records
1. customer
2. account
and their fields:
 customer: name, street, city
 account: number, balance
Slid
e 27

Sample Database corresponding to ER Diagram in previous
slide
Slid
e 28



The content of a particular record may be replicated in several
different locations
For example in banking system an account may belong to different
customer, in this case account information would be replicated at
different location.
Record replication has two major issues:
◦ Updating of record may result in Data inconsistency
◦ Waste of space
Slid
e 29
Network Model





A network database consists of a collection of records
connected to one another through links.
A record is a collection of fields, each of which contains only
one data value.
The network model differs from the hierarchical model in
that the records are organized as graph rather than a tree.
The schema for a Network database consists of
◦ boxes, which correspond to record types
◦ lines, which correspond to links
Hierarchical database model structures data as a tree of
records, with each record having one parent record and
many children while, the network model allows each record
to have multiple parent and child records, forming a
generalized graph structure
Network Model(cont..)

Consider the customer-account relationship where an
account belongs to more than one customer.

Network Database diagram for the above ER diagram will be
Slid
e 211
Network Model(cont..)

Consider same customer-account relationship with access
date which gives information about the date of access of an
account

Question
◦ Draw Hierarchical database diagram and Network database diagram for
the above ER Diagram where an account belongs to more than one
customer.
Slid
e 212
Relational Data Model





Relational model was first introduced by Ted Codd of IBM
Research in 1970.
This model uses the concept of a Mathematical relation as its
building block.
It has its theoretical basis in set theory and first-order
predicate logic.
In relational model, database are represented as a collection
of relations. Relation resembles as table of values where each
row in the table represented as collection of related data
values.
Each row in the table is called tuple and each column is
called attribute.
Slid
e 213
Object Oriented Data model
Traditional data models such as relational, network, and
hierarchical, have been quite successful in developing the database
technologies for many traditional business database applications.
 However, Relational, Network and Hierarchical models have
certain shortcomings to design complex database applications such
as databases for engineering design and manufacturing
(CAD/CAM),
scientific
experiments,
telecommunications,
geographic information systems, and multimedia.
 Object oriented databases have been proposed to meet some of
the needs of these more complex database applications.
 An object database (also object-oriented database management
system) is a database management system in which information is
represented in the form of objects as used in object-oriented
programming.
Slid

e 214
Object Oriented Data model(cont..)





Object databases provide the designer to specify both the
structure of complex objects as well as operations that can
be applied to these objects.
Object databases are designed in such a way that they can be
directly integrated with software developed using objectoriented programming languages.
OO database extend the existence of objects so that they
are stored permanently in a database, and hence the objects
become persistent objects.
Persistent objects exists beyond program termination and can
be retrieved later.
Object Definition Language: ODL is the standardized language
for defining the structure of database with respect to the
object data model.
Slid
e 215
Object Oriented Data model(cont..)
An object is described by following characteristics
Identifier: a system-wide unique id for an object
 Name: an object may also have a unique name in DB
(optional)
 Lifetime: determines if the object is persistent or transient
 Structure: Construction of objects using type constructors

Slid
e 216
An Example of Object oriented object creation
Slid
e 217
Advantages of OODBS
Designer can specify the structure of objects and their
behavior (methods)
 Better interaction with object-oriented languages such as
Java and C++
 Definition of complex and user-defined types
 Encapsulation of operations and user-defined methods

Slid
e 218
Object v/s Relational Models
Slid
e 219
Object-Relational Model
The relational model with object database enhancements is
sometimes referred to as the object-relational model.
 Some object oriented features have been added in SQL-99
such as

◦ Inheritance mechanism have been added
◦ Encapsulation of operations
◦ Mechanism for specifying Object identity
◦ Addition of type constructors to specify complex
objects. In this way a user can define their own data types
such as
create row type AddressType(
street char(50),
city char(20));
◦
Slid
e 220
Summary
The structure that can help or organize the
database using logical relationship.
 We have different data models for
different parties.
 Conceptual model is used to define the
database.

Slid
e 221
Download