Thursday, July 10, 2014

Data Models


After inventing of DBMS, several models are proposed stating various ways of representing data within the database and their advantages, called as data models. These data models are classified into three categories based on their purpose as follows.

  1. Physical Data Models
  2. Conceptual Data Models
  3. Logical Data Models
Physical Data Models : The data models that concentrate on how the data is physically stored within the database are called as physical data models.

Conceptual Data Models : The data models that concentrate on how the data and relationship between data can be represented diagrammatically are called as conceptual data models. One of the most popular conceptual model is Entity-Relationship Model(E-R Model).

E-R model uses the terminology Entity, Attribute and Relationship.  An entity is a real world object stored within the database. If you store student information in the database, then student is called an entity, if you store employee information within the database, then employee is called an entity and so on. An attribute is a characteristic feature of the entity. For student entity sid, sname, course, address all these are called as attributes. A relationship is an association between entities. Relationship between entities are classified into one to one(1:1), one to many(1:M) and many to many(M:N).

ER Diagrams:


Within E-R diagrams an entity is represented with a rectangle, an attribute with oval shape and relationship with diamond shape etc. 

The E-R diagram for the entities Student and Course is as follows. The relationship type between course and student is one to many. This is because one student can join only one course and a course can be chosen by any number of students.
                     
Logical Data Models : The data models that concentrate on what data is stored in the database and what type of relationship exist between data are called as logical data models. The following lists of logical data models are available.
1.    Hierarchical Data Model
2.    Network Data Model
3.    Relational Data Model
4.    Object Data Model
5.    Object Relational Data Model

Hierarchical Data Model : in this data model data is organized hierarchically like in tree data structure. Within hierarchical database model it is not possible to represent many to many relationships. This drawback leads to the development of network data model. Student information can be represented in hierarchical data model as follows.


Network Data Model : in this data model also data is represented same as in case of hierarchical data model except that it can represent many to many relationship. Student information is represented in network data model as follows.


     

  In both hierarchical and network data models, organization of data is very difficult as it is organized like a tree data structure. Especially deleting a record will be very complex process as all records that are based on deleted record must be rearranged. These drawbacks lead to the development of relational data model.

Relational Data Model : Relational data model was proposed by E.F.Codd in 1970. He proposed the model theoretically and first practical implementation of relational model was System-R and is developed by IBM Corporation. In relational data model data is organized in the form of attributes, tuples and relations. Attribute, tuple and relation can be compared to a field, record and file in file management system. These are technical terms given by E.F. Codd and now a days these terms are replaced with column, row and table respectively.
As organization of data in relational data model is similar to file management system, it is very easy to maintain when compared to hierarchical and network data models. Now a days most of the DBMS are RDBMS. Examples are SQL Server, Oracle,DB2, MS Access etc.,

Object Data Model : This data model is based on object oriented concepts of programming. This model provides OOP features within the database. This model also becomes popular as it has advantages of OOP. Examples are Object Store, Cactus etc.,

Object Relational Data Model : this model combines the features of object data model with the features of relational data model. Hence this model has both the advantages of relational data model as well as object data model. Example is Oracle 8.0 onwards.

No comments: