Data Models in DBMS

 

Data Models 

·         Helps in the real-world representation of data.

·         Useful for the developer to understand the relationship between various objects in the database.

·         Helps to highlight any drawbacks of the plan and correct it at the design stage.

·         Determines the logical structure of a database (Describe the structure of the database including data type’s relationships and constraints. )

·         Easier to understand each user’s requirement of data, nature of the data itself, and use of data in the application area. (in which manner data can be stored, organized, and manipulated in a database management system.)

·         Supports communication between the user and database designer. 

 

Data models characteristics are:-

·         Diagrammatic representation.

·         Simplicity in design.

·         Define data and their relations.

·         Useful for database designers.

·         Application independent.      

·         Shared by different applications.

·         No duplication representation of data.

·         Consistency and structure validity.

·         Follow the bottom-up approach.

   

Divided data models into 3 categories –  

1.     Object-Based models

2. Physically-based models

3. Record-based Data models.



1. Object-based Data Models

-          Design the entities, attributes, and their relationship in the real world.

-          Also known as conceptual models.

-          There are two types of object-based data Models

-          Entity-Relationship Model

- Object-oriented data model.

 

A.   Entity-Relationship Model (ER data model)

 

-          Defines the mapping between the entities.

-          Describes the state of each entity and the tasks in the database.

-          Describing data at the logical and use at view levels.

 

This model considers a top-down approach for designing.

Advantages

· It is simple and easily understandable by simple diagrams.

· Easily covert ER diagrams into the record-based data model.

· Easy to understand

Disadvantages

· No standard representations for ER diagram.

· flexible in the representation depends upon the designer.

· Related to high-level designs, cannot simplify at low level (like coding).

 

B.    Object-Oriented Data Models

·         Represents real-world objects.

·         Based on the collection of objects, attributes, and their relationship.

·         Consider each object in the world as an object and isolate it from the other.

·         Use inherits, encapsulation, abstraction properties.

·         Mainly used for the multimedia application as well as data with Complex relationships

 

Example:- In an Employee database we have different types of employees – Engineer, Accountant, Manager, Clark. But all these employees belong to the Person group. The person can have different attributes like name, address, age, and phone.

All employees inherit the attributes and functionalities from Person, we can re-use those features in Employee.

 This feature of this model is called encapsulation.


Advantages

· Re-use the attributes and functionalities (Codes) (inheritance property).

· Reduces the overhead and maintenance costs and maintains the same data multiple times.

· No fear of misuse by other objects.

· Easily add a new class, which is inherited from a parent class, and add new features.

· More flexible.

· Each class binds its attributes and its functionality.

 

Disadvantages

· Not widely developed and complete to use in the database systems, so not accepted by the users.

· It is an approach for solving the requirement, not a technology.

 

2. Physical Data Models

·         It describes: -

how data are stored in computer memory,

how they are scattered and ordered in the memory, and

how they would be retrieved from memory.

·         Represents the data at the data layer or internal layer. 

·         Operated by the specified user. 

·         Use frame memory models. 

·         It represents each table, its columns, and specifications, constraints like primary key, foreign key, etc. 

·         Basically represents how each table is built and related to each other in DB.




The diagram shows CLASS as the parent table and it has 2 child tables – STUDENT and SUBJECT.

The primary key is represented at the top.

The relationship between the tables is represented by interconnected arrows from table to table.

 

 

3.    Record based Data Models

·         Based on application and user levels of data.

·         Considering the logical structure of the objects in the database.

·         Defines the relationship between the data in the entities.

 

For example, employee and department entities are related to each other by the department.

 

There are 3 types of record based data models

1. Hierarchical,

2. Network and

3. Relational data models.

 

1.    Hierarchical Data Models

Describes many real-world relationships.

First database model or oldest database models, introduced by  IBM (based on the material bill in the 1960s).


Characteristics

1.    Define records as a tree-like structure.

2.    Define the hierarchy of parent and child record relationships.

3.    This model has two main concepts record and the parent-child relationship.

4.    Record is a collection of field values that provides information about an entity.

5.    A parent-child relationship shows a link or connectivity between two records.

6.    The data are stored as records.

7.    The type of a record defines which fields the record contains.

8.    This model shows that each child record has only one parent, but each parent record can have one or more child records.

9.    In order to retrieve data from a hierarchical database the whole tree needs to be traversed starting from the root node.

 

Operation on the hierarchical model

We can perform various types of basic operations in the hierarchical model which are insertion-deletion retrieval and update.

 Advantage 

1.    Simplicity: - define the simple parent-child relationship. 

2.    Integrity of data: - each child node can be linked with only one parent and a child node can be accessed (read) by only its parents.

3.    Data security: - in this model accessing, updating, and deleting the child node with proper information of parent node. Otherwise not possible.

4.    Efficiency:- it defines one to many relationships between parent and child records.

5.    Handle transaction efficiently: -  very efficient to handle the large number of transactions using links or relationships which are defined by the pointers.

 

Disadvantage

1.    Knowledge of the physical level of the data store is required.

2.    Define redundancy problem.

3.    Pointers required for defining data stored reference. For this technical skills are required.

4.    Increase complexity when expanding or modifying the database change.

5.    Not flexible to establish all types of relationships, mainly many to many.

6.    Many to many relationships require many pointers which create complexity.

7.    Pointers need navigation to access information,  which is a complicated task.

8.    Not provide query(DDL, and DML) facility.

9.    Modification of the data structure and creating new relations or nodes is very complicated.

10.  Data manipulation operations (like deletion and updation) are very complex.

11.  Not useful for any specific or big-size database design and modeling.

====================================================================

 

2. Network Data Models

·         Network model was standardized as the CODASYL & DBTG (conference of data system language, database task group).

·         In this model two main basic data structures are used first records and second sets.

Records:-  contains detailed information regarding the data which are classified into record types.

Sets:-  used for the represent relationship between record types, for this linked list is used.

·         Each set type defines three basic elements- the name of set type, an owner record type (linked parent), and member record type( like child’s).  

·         This is the improved version of the hierarchical data model (solves the drawbacks of the hierarchical model).

·         It uses or defines M: N relationship. (many to many relationships).

·         Allow accessing more than one parent node.

·         This model is organized like a graph.

·         Accessing the data is easier and fast in this model.


Example:- A company has different projects and departments. Suppliers of the company give input for the project. The project has multiple parents and each department and supplier have multiple projects.

 

·         Network models perform various types of operations which are 1. Insertion 2.  Deletion 3. Updation and 4. Selection

 

Advantage of network models 

The network model provides various types of advantages in comparison to the hierarchical model  

1.      Elimination data redundancy

Only one occurrence for a particular record in the database can refer to other records using the link for pointer so no multiple occurrences of records. 

2.      Lesser storage requirement

Record occurs only once without repetition so lesser storage is required for storing the records in the database.

3.      Better performance

The relationship is defined directly with the records so it gives better performance.

This model provides different types of relationships such as one to one, one to many, many to many, etc.

It represents real-world situations that are easily defined in the database.

4.      Easy access of data

Records are accessed by the pointers so it is very easy to move from one owner record to another.

5.      Data integrity

Provides Data integrity due to owner membership relationship.

6.      Enforce standards  

This model is based on CODASYL DBTG. 

7.      Data independency

This model provides a structure of data that can be changed without modifying the application program with the independence of data.

 Disadvantage

       I.            Complexity

The conceptual design of this model is simple but the design at the hardware label is very complex because a large number of pointers are required to show the relationship between the owner and member records.

    II.            Difficulty in querying data 

This model programmer works with links and defined how to traverse them to get desired information so proper technical skills are required.

 III.            Lack of structural independency

There is no independence between any objectsAny changes to any of the objects will need changes to the whole model. Hence difficult to manage.

it is very difficult to change in database structure otherwise all application programs use modification or crash.

 IV.            Difficult to design the relationship

Difficult to design the relationship between the entities, since all the entities are related in some way for this requires thorough practice and knowledge about the design.

 

===================================================================

3. Relational Data Models

 Properties of the relational model

·         This model is designed to overcome the drawbacks of hierarchical and network models.

·         This model was introduced by Dr. Edgar Frank Codd (mathematician and working for IBM in 1970).

·         Most widely used database model around the world.

·         It is purely based on how the records in each table are related.

·         Isolates physical structure from the logical structure.

·         Logical structure is defined records.

·         Data is organized in the two-dimensional matrix as table structure known as relations.

·         Relationship is maintained by storing a common field.

All the information related to a particular type is stored in rows of that table.


 ·         It is concerned with data, not physical storage detail.

·         It enables the computer system to handle queries efficiently.

·         Column and row have atomic value and the same kind.

· Columns are known as attributes that represent the characteristics of an item or table example roll number, student name.

·         It provides information about the metadata, meta-data contains information about the table structure.

·         Table can be joined and define its result in a table form.

·         Each row is unique.

·         We can retrieve columns by any order.

·         Each table contains rows known as tuples which represent a collection of information about separate items example customer records.

·         Rows of the table can be reviewed oratory in a different order.

·         Sequence it may be either ascending or descending or random.

·         Each has a unique name.

·         This model is considered as representing the most real-world objects and the relationship between them.

·         This model absolutely separates the logical view from its physical view of data.

·         Provides various types of operation by the queries as commands ex. DDL, DML.

·         This model is based on the mathematical concepts of set theory.

 

Terminology

Relation:-  table.

Tuple:-   row or record.

Attribute:-  column or field.

Domain:- set of legal values in  Colum.

Cardinality:- Number of rows in a table.

Degree:-  number of columns in the table.

Primary key:-  unique key on which depends other keys.

Foreign key:-   primary key of one table used in another table as a reference.

 

Advantage 

1.      Simplicity

Very easy and simple to design and implement at the logical level database using appropriate attributes and data values in the tabular format.

2.      Flexible

We can change to database structure according to our requirements.

3.      Data independency

We can change the structure of the database without having any changes without affecting the application.

4.      Structural independency

This model is only concerned with data not with the structure so it improves performance in the form of processing time and storage space.

5.      Query capability

This model belongs to high-level query language like SQL structure query language to avoid Complex database navigation, not requiring any pointers.

6.      Mature Technology

It provides real-world objects and relationships which is easy by the use of keys concept.

 Disadvantage

Relational models have various disadvantages which are 

1. Relational database uses a simple mapping of logical tables two physical structures by the indexing and hashing technique for accessing table data for this it used certain limits in the form of constraint.

2. It does not work perfectly as an object-oriented database management system. 

3. It has limited ability to deal with a binary large object such as images spreadsheets audio videos etc.

4. This model increases hardware overheads which are costly.

5. Mapping objects to a relational database can be a difficult skill to learn.

6. To ensure Data integrity is a very difficult task because no single application has control over the data.

7. It is not suitable for huge databases.

8. for separate the physical data information from the logical data, more powerful system hardware’s – memory is required. This makes the cost of the database high.

 

===========================================================  

Post a Comment

0 Comments