What are the different kinds of data models?
Answer: Kinds of Data Models in Computer System
A data model describes how data are represented and accessed. Data model formally defined data elements and relationships among data elements for a domain of interest.
Types of data models :
There are basically two types of data models:
I. Record-based data models.
II. Object-based data models.
I. Record based data models:
In record‐based models, it organized the database in fixed‐format records of several types. A fixed number of fields, or attributes, are defined in each record type, and each field is usually of a fixed length.
The three most popular record‐based data models are:
1. Relational data model
2. Network data model
3. Hierarchical data model
1. Relational data model:
(i) The relational model uses tables to represent the data and the relationships among those data.
(ii) Each table has multiple columns, and a unique name identifies each column.
(iii) It is a low-level model.
Advantages of relational data model :
(a) Structural independence: Relational database model has structural independence, i.e. changes made in the database structure do not affect the DBMS’s capability to access data.
(b) Simplicity: The relational model is the simplest model at the conceptual level.
(c) Ease of designing, implementation, maintenance, and usage: The relational model makes it easy to design, implement, maintain and use the databases.
(d) Ad‐hoc query capability: One of the major reasons for the immense popularity of the relational database model is its powerful, flexible, and easy-to-use query capability.
Disadvantages of relational data model:
(a) Hardware overheads: The RDBMS needs comparatively powerful hardware as it hides the implementation complexities and the physical data storage details from the users.
(b) Ease of design can cause poor design: As the relational database is an easy-to-design and use system, it can result in the development and implementation of poorly designed database management systems. As the size of the database increases, several problems may arise like system shutdown, performance degradation, and data corruption.
2. Network data model :
(i) In the network model, data are represented by collections of records.
(ii) Relationships among data are represented by links.
(iii) In this model graph data structure is used.
(iv) A network model permits a record to have more than one parent.
Advantages of network data model:
(a) Simplicity: The network data model is also conceptually simple and easy to design.
(b) Ability to handle more relationship types: The network model can handle the one-to-many and many‐to‐many relationships.
(c) Ease of data access: In the network database terminology, a relationship is a set. Each set comprises two types of records, an owner record, and a member record.
(d) Data integrity: In a network model, no member can exist without an owner. A user must therefore first define the owner record and then the member record. This ensures data integrity.
(e) Data independence: The application programs work independently of the data. Any changes made in the data characteristics do not affect the application program.
(f) Database standards: The standards devised by the DBTG (Database task group of CODASYL committee) form the basis of the network model.
Disadvantages of network data model :
(a) System complexity: In a network model, it accesses data one record at a time. Therefore, a user-friendly database management system cannot be created using the network model.
(b) Lack of structural independence: Making structural modifications to the database is very difficult in the network database model as the data access method is navigational. Any changes made to the database structure require the application programs to be modified before they can access data. Though the network database model achieves data independence, it still fails to achieve structural independence.
3. Hierarchical model :
(i) In the hierarchical model, data are represented by collections of records.
(ii) Relationships among data are represented by links.
(iii) In this model tree data structure is used.
(iv) There are two concepts associated with the hierarchical model‐segment types and parent‐child relationships. Segment type is like the record types in the network models. The information retrieved only by navigating from the root segment type to the nodes segment types. Thus we can access a segment type only via its parent segment type in the parent‐child relationship. The operators provided for manipulating such structures include operators for traversing hierarchic paths up and down the trees.
Advantages of the hierarchical model :
(a) Simplicity: Since the database is based on the hierarchical structure, the relationship between the various layers is logically simple.
(b) Data security: Hierarchical model was the first database that offered the data security that is provided and enforced by the DBMS.
(c) Data integrity: Since the hierarchical model is based on the parent/child relationship, there is always a link between the parent segment and the child segment under it. The child segments are always automatically referenced to their parent, this model promotes data integrity.
(d) Efficiency: The hierarchical database model is a very efficient one when the database contains a large number of one‐to‐many relationships and when the users require numerous transactions, using data whose relationships are fixed.
Disadvantages of hierarchical model :
(a) Implementation complexity: The hierarchical database model is conceptually simple and easy to design, it is quite complex to implement.
(b) Database management problems: If we make any changes in the database structure of a hierarchical database, then it is required to make the necessary changes in all the application programs that access the database.
(c) Lack of structural independence: Structural independence exists when the changes made to the database structure do not affect the DBMS’s ability to access data. Hierarchical database systems use physical storage paths to navigate to the different data segments. So the application programmer should have a good knowledge of the relevant access paths to access the data. So if the physical structure is changed, the applications will also have to be altered. Thus, in a hierarchical database, the benefits of data independence are limited by structural dependence.
(d) Programming complexity: Hierarchical model requires knowledge of complex pointer systems, which is difficult for users who have little or no programming knowledge.
(e) Implementation limitation: The many‐to‐many relationships, which are more common in real life, are very difficult to implement in a hierarchical model.
II. Object-based data models:
In object‐based models, the database is organized into real-world objects of several types. A number of fields, or attributes, are defined in each object type, and each field is usually of a variable length.
The two most popular object‐based data models are:
1. Object-oriented model 2. ER model
1. Object-oriented model:
(i) The object-oriented model is based on a collection of objects, like the ER model.
(ii) An object contains values stored in instance variables within the object.
(iii) Unlike the record‐oriented models, these values are themselves objects.
(iv) Thus objects contain objects to an arbitrarily deep level of nesting.
(v) An object also contains bodies of code that operate on the object. These bodies of code are called methods.
(vi) Objects that contain the same types of values and the same methods are grouped into classes.
(vii) A class may be viewed as a type definition for objects.
(viii) Analogy: the programming language concept of an abstract data type.
(ix) The only way in which one object can access the data of another object is by invoking the method of that other object. We call this sending a message to the object.
(x) Internal parts of the object, the instance variables, and method code, are not visible externally.
(xi) Result is two levels of data abstraction.
Example: Consider an object representing a bank account.
(1) The object contains instance variables number and balance.
(2) The object contains a method pay interest which adds interest to the balance.
(3) Under most data models, changing the interest rate entails changing code in application programs.
(4) In the object-oriented model, this only entails a change within the pay_interest
(xii)Unlike entities in the E‐R model, each object has its own unique identity, independent of the values it contains :
(1) Two objects containing the same values are distinct.
(2) Distinction is maintained in physical level by assigning distinct object identifiers.
Advantages of object-oriented data model :
(a) Capability to handle the large number of different data types: Traditional database models like hierarchical, network, and relational databases are limited in their capability to store the different data. For example, one cannot store pictures, voices, and videos in these databases. But the object-oriented database can store any type of data including text, numbers, pictures, voice and video.
(b) Combination of object‐oriented programming and database technology : Perhaps the most significant characteristic of object‐oriented database technology is that it combines object‐oriented programming with database technology to provide an integrated application development system.
(c) Data access: Object-oriented databases represents relationships explicitly, supporting both navigational and associative access to information.
(a) Difficult to maintain: Object-oriented data model is difficult to maintain when organizational information changes.
(b) Not suited for all applications: Object‐oriented database systems are not suited for all applications.
2. ER model (Entity relational model) :
(i) The entity‐relationship model is based on a perception of the world as consisting of a collection of basic objects (entities) and relationships among these objects.
(ii) It is an object‐based logical model.
(ii) It is a high‐level data model.
(iii) An entity is a distinguishable object that exists.
(iv) Each entity has associated with it a set of attributes describing it. Example: Number and balance for an account entity.
(v) A relationship is an association among several entities.
Example: A Cust‐Acct relationship associates a customer with each account he or she has.
(vi) The set of all entities or relationships of the same type is called the entity set or relationship set.
(vii)Another essential element is the ER diagram in which the mapping cardinalities express the number of entities to which another entity can be associated via a relationship set.
(viii) The overall logical structure of a database:
(1) Rectangles: represent entity sets.
(2) Ellipses: represent attributes.
(3) Diamonds: represent relationships among entity sets.
(4) Lines: link attributes to entity sets and entity sets to relationships.
Advantages of ER Model :
(a) Conceptually it is very simple: Making the ER diagram is a very easy process. We just know about the notations of various types of entities, their attributes, and the relationships between these entities.
(b) Better visual representation: The ER model gives a graphical and diagrammatical representation of various entities, their attributes, and relationships between entities.
(c) Effective communication tool: It is an effective communication tool among users, domain experts, and database designers.
(d) It is highly integrated with the relational model, so converting ER models to tables is very simple.
(e) Easy conversion to any data model: Conversion of ER model to any other data model
like network model, hierarchical model and the relational model is very easy.
(a) Limited constraints and specifications.Example: minimum cardinality.
(b) Loss of information content. Example: FAN Trap, CHASM Trap.
(c) No industry standard for notation: There is no industry standard notation for developing an ER model.
(d) Popular for high-level design: The ER data model is especially popular for high-level design.
(e) No representation of data manipulation in the ER model.