Unit-1 Ch-2 Data Models New
Unit-1 Ch-2 Data Models New
Data Models
(BCA-110)
1
Data Models
• Data Model:-
A database model or simply a data model is an abstract model that describe how the data are
represented and used. i.e. A data model is a collection of concepts that can be used to describe
the structure of a database and provide the necessary means to achieve this abstraction where as
structure means the data types, relationship and constraints that should be applied on data.
A data model not only describes the structure of the data, it also defines the set of operations that can
be performed on the data. Data model operations are used for specifying database retrievals and
updates by referring to the construct of data model.
a.Object-Based Data Model e.g. Entity – Relationship Model, Object – Oriented Model
b.Record-Based Data Model e.g. Relational Model, Network Model, Hierarchical Model
2
Data Models
• Object Based Data Model:-
These model are used to describe data and its relationship. These models describe data at
conceptual and external level. It uses the concepts such an entity, attribute and relationship. They
provide fairly flexible structuring capabilities and allow data constraints to be specified explicitly.
This model include: Entity – Relationship Model, Object – Oriented Model, Binary Model, Semantic
Model, Functional Model.
1) Entity – Relationship Model (E – R Model):-
It was introduced by Dr. Peter “Chen” in 1976 as a way to unify the networks & relational data base
view. It views the real word as set of basic objects (entities), their characteristics (attributes) and
association among these objects (relationship). It is a collection of objects of similar structure
called an entity set and relationship among these objects. Here over all logical structure of a
database can be expressed graphically by E-R diagram as follows:
• Rectangle ( ) : Represents entity sets.
• Ellipse ( ) : Represents attributes.
• Diamond ( ) : Represents relationship among entity sets.
• Lines ( ) : Link between attribute & entity sets also between entity sets & relationship set.
• Two entity sets customer & account can be modeled as:
Number
Name
Address Customer Has Account
id Balance 3
Data Models
• Object Based Data Model:-
Advantages of E – R Model:-
i. E-R diagram has straight forward relational representation.
ii. Can be easily converted to network or hierarchical easily.
iii. Graphical representation for better understanding.
iv. It is simple & easy to understand so can be used as an effective communication task between the
database designer & user.
Disadvantages of E – R Model:-
i. No industry standard nation.
ii. Popular for high level design.
4
Data Models
• Object Based Data Model:-
E.g. If we have bank account as object then all various instance will have data items such as
balance, deposit, withdraw etc. These instance will also contain certain methods such as pay
interest, add interest & balance etc.
5
Data Models
• Object Based Data Model:-
Advantages of Object oriented Model:-
i. Capable of handling a large variety of database:- Object oriented database are capable of
storing different types of data eg. pictures, audios, including text & numbers together.
ii. Combining object oriented programming with database technology:- This model is capable of
combining OOPS with database technology and thus providing an integrated application
development system.
iii. Improved productivity:- OOD models provide powerful features such as inheritance,
polymorphism and dynamic binding that allow users to compose object and provide solution
without writing object specific code.
iv. Improved data access:- OOD model represents relationship explicitly and both data & method
that operate on data are combined together which improve data access performance.
v. It has ability to mix and match reusable objects.
Disadvantages of Object Oriented Model:-
i. No precise definition:- It is very difficult to provide a precise definition of what constitutes an
object oriented DBMS.
ii. Difficult to maintain:- As the definition of objects may be changed periodically and migration
of existing database to new object database becomes very difficult.
iii.Not Suitable for all application:- OOD model are especially suitable for specific application such as
engineering, medicines etc but not for all application
6
Data Models
• Record Based Data Model:-
These models are also used in describing data at conceptual and view level. These are used to specify
over all logical structure of database and provide higher level description of implementation. In this
model database is structured in a fixed format records of several type so named as record based.
Each record type defines fixed number of attribute of fixed length. It does not include mechanism of
direct representation of code in database. But a separate language associated with model are used to
express data base queries & updates.
1) Relational Data Model:-
This model was introduced Dr. E. F. Codd in 1970. This model uses a collection of table to
represent both data & relationship. Each database may have multiple table with unique name and
each table may have multiple columns with unique name. So it is a collection of tables (called
relation) in which data is stored, each table is a matrix of series of row & column interactions.
Tables are related to each other by sharing the common entity characteristics. In the following
example Table1 shows customer details & Table2 shoes accounts details:
8
Data Models
• Record Based Data Model:-
2) Network Data Model:-
This model was given by DBTG/CODSAYL (Database Task Group of the Conference on Data
System Languages) in 1960. In this model data is represented by then collection of records and
relationship among data is done through links. So records in database are organized as a collection
of arbitrary graphs. In network model a relationship is called a set which is composed of at least two
record type First is called owner record and second is called member record i.e. It has basic 3
component such as record type data items and links. In this model owner record can have any no of
member records and a member record can have any number of owner records. E.g.
Dept1 Dept2
Project1 Project2
9
Data Models
• Record Based Data Model:-
Advantages :-
i. Simplicity:- This model like relational is also simple and easy to use.
ii. More Relationship Type:- Network model helps in handling one-to-one and many-to-many
relationship which helps in modeling real life problems.
iii. Superior Data Access:- Data access and flexibility is superior to that is found in any other
model. Also application can access an owner record all member record with in a set.
iv. More connections can be made between types of data, so network database are considered more
flexible.
Disadvantages :-
i. System Complexity:- This model provide navigational access mechanism to the data. This
system makes system implementation very complex.
ii. Absence of Structural Independence:- It is very difficult to make changes in network database.
If changes are made to the database structure all subschema definition must be restructured
before any application program can access the database.
iii. Operational Anamolies
10
Data Models
• Record Based Data Model:-
3) Hierarchical Data Model:-
This is similar to the network model, but difference is that the records are organized in the form of
tree in place of arbitrary graph. A tree may be defined as a set of nodes such that there is one
specially designed node called root node which acts as parent and remaining nodes are portioned
into disjoint set and perceive as children of the above node. E.g.
Root Node
S_ID Sname Age
123 Ram 20 987 Sham 18 456 Sita 19
11
Data Models
• Record Based Data Model:-
Advantages-
i. Simplicity:- This model like relational is also simple and can be accessed & updated rapidly
because the relationships between records are defined in advance .
ii. Quick Processing:- In this model records are usually specifically organized to maximize the
speed, so processing of data can be done quickly.
iii. Easy to Establish Relationship:- Any group of record with a natural, hierarchical relationship to
other record fits nicely with in the structure.
iv. Data Sharing is possible
Disadvantages :-
i. Limited Scope of Relationship:- The relationship between child is not permitted.
ii. Difficult to Insert:- Hierarchical database are so rigid in their design that adding a new
record/field require that entire database be redefine i.e. lack of structural independence.
iii. Other Operational Anomalies-
iv. Data management Problem
12
Data Models
• Physical Data Model:-
These model are used to specify data at lowest level i.e. description of storage structure & access
mechanism. They describe how the data stored in the computer. There are few physical data model.
Unifying Model, Frame Memory Model.
Comparison of Data Model Basic Terminology
File Relational Network Hierarchical
Real World Example E – R Model OO Model
Processing Model Model Model