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

www.jntuworld.com www.jwjobs.

net

Le c ture N ote sForDBM S a nd Da ta M ining a nd Da ta W a re housing

Lecture 4
Data Models
? A data model is a collection of concepts for describing data, data relationships, data
semantics and consistency constraints.
? A schema is a description of a particular collection of data, using a given data model.
? Primary categories for various data models are:
o Object-based logical models
? Provide very high level design of the database
? Provide flexible structuring capabilities. The most popular ones are as
follows:
? The Entity-Relationship model
? The object oriented model
? The semantic model
? The functional model
o Record-based logical models
? Provide more implementation based design
? Specify overall logical structure of the database and provide high level
description of the implementation
? The most popular ones are as follows:
? Relational Model
? Network Model
? Hierarchical Model
o Physical models
? Describe data at the lowest level
? Captures aspects of database-system implementation
? Widely known are unifying model and frame-memory model
Entity Relationship model (E-R Model):
? Identifies basic elements, or objects, or entities which are core to the data base
? Consider for example the Library database. Most basic entities of a library can be
identified as books and users. There are other basic entities like suppliers, magazines,
journals etc..
? We describe the database generally be diagrams called E-R diagrams when using ER
Model.
? The sample E-R diagram for the above mentioned simple library database having only
two entities Books and Users can be formed as follows.
? All of the entities of type book will be represented by an entity set.(represented by
rectangle)
BO O K

? Similarly we represent all users by an entity set


U S ER

Departm ent ofElectricaland Electronics By:S ulabh Bansal

www.jntuworld.com
www.jntuworld.com www.jwjobs.net

Le c ture N ote sForDBM S a nd Da ta M ining a nd Da ta W a re housing

? We identify what are various attributes that describes the entities of an entity set. A book
is described in library by its Accession Number, Call Number, Title, Author, Publisher,
Year of publication etc. They are attached to entities as Ellipses as shown below:

Acc.N o. Yr.ofP ub.

BO O K

P ublisher
CallN o..

T itle Author

? Similarly we associate attributes which defines a user in library to the respective entity in
E-R diagram as shown below

Card.N o.

U S ER

N am e

U serT ype U serID

? Apart from entities E-R model describes the relationships between the entities. They are
again seen as relationship sets existing between Entity sets. For example a user can
borrow a book from library. All of those relationships between any book of library to any
user are represented by a relationship set. We can name it as borrowed by relationship
set. Borrowed By relationship can again have its own attributes which exists only when a
relationship exists. For example Date of Issue exists only when a book has been
borrowed by a particular user it is neither the attribute of Book nor of User. We represent
the relationships by diamond in E-R diagrams as shown below:

Departm ent ofElectricaland Electronics By:S ulabh Bansal

www.jntuworld.com
www.jntuworld.com www.jwjobs.net

Le c ture N ote sForDBM S a nd Da ta M ining a nd Da ta W a re housing

Acc.N o.
Card.N o.
BO O K Borr. U S ER
CallN o.. By
U serID

P ublisher
U serT ype
Date ofissue
Yr.ofP ub. N am e

T itle Author

Relational Model:

? Both the data and relationships are represented by tables


? So it is closer to implementation of the ER diagrams designed in first phase of modeling.
? The entities BOOK and USER can be represented by respective tables where columns of
the table represent the attributes of the entity. Every Column has unique column name
corresponding to its attribute name. The values are filled into the table for different
entities of this set.

Book Table:
Acc. No. Call No. Title Author Publisher Yr. of
Publication
312 245 Database System Silberschatz, McGrawHill 1997
Concepts Korth, Sudarshan
433 23 Fundamental of Elmasri, Navathe Addison Wesley 1999
Database Systems

User Table:
Card No. Name User Type User ID
422 Abhishek Student 0706412234
4322 Mr. Lalit Faculty 23456789

? The relationships can also be represented by tables. They include only those attributes of
the related entities which are sufficient to identify them uniquely and possibly attributes
which are specific to the relation

Borrowed By Table:
Book Acc. No. User Card No. Date of Issue
312 422 03/08/2010
433 4322 05/08/2010

? The above relationship table shows that User Abhishek has borrowed Database System
Concepts by Silberschatz, Korth, Sudarshan and user Mr. Lalit has borrowed
Fundamental of Database Systems by Elmasri, Navathe from library on 03/08/2010
and 05/08/2010 respectively.

Departm ent ofElectricaland Electronics By:S ulabh Bansal

www.jntuworld.com
www.jntuworld.com www.jwjobs.net

Le c ture N ote sForDBM S a nd Da ta M ining a nd Da ta W a re housing

Network Model:
? Data in Network Model are represented by collection of records.
? Relationships between data are represented by links or pointers.
Book1 User1
312 245 Database * 422 Abhishek Student *
System
Concepts

* * *
Book2
433 23 Fundamental *
of Database 4322 Mr. Lalit Faculty *
Systems
Book3
434 24 Fundamental *
of Database
Systems
? The above diagram shows 5 data records each having the several data values for
corresponding attributes and an extra field marked as *which is used for link or pointer.
? Whenever a relationship exists between two data elements that is explicitly shown by
using the pointers. So relationship of BOOK1 and BOOK2 with USER1 is shown by
pointers in BOOK1 and BOOK2 records. Similarly the USER1 is related to these books
and they can be shown by circular linked list. This list contains only pointers. One such
list is pointed by the link field of USER1 which in turn contains list of pointers to all of
the books which are borrowed by USER1 and last pointer points back to USER1.
? So the combination of data records and links can be used in any way to form the network
of data as per the convenience of designers and programmers.

Hierarchical Model:
? This one is very similar to Network Model in terms that it also uses records and links to
represent data and relationships respectively.
? The difference is that Network Model forms a network or graph of data and connections
while Hierarchical model forms only trees which doesnt allow cycles.
? The data elements present in the model have parent-child relationships. Where the data
nodes which are pointing are called parents and those nodes which are pointed by their
parents are called child.
? Any child data node cannot be pointed by two different parents.
? For example if we put Books as parents and Users as children then two books cannot
point to same user record. In that case we will have to replicate the record of user for
each book
Book1 Book2
312 245 Database * 433 23 Fundamental *
System of Database
Concepts Systems
434 24 Fundamental *
of Database
Systems

User1 User1 User 2


422 Abhishek Student * 422 Abhishek Student * 4322 Mr. Lalit Faculty *

Departm ent ofElectricaland Electronics By:S ulabh Bansal

www.jntuworld.com

You might also like