Underlying structure of the database is called as data model. It is a collection of conceptual tools for describing data, data relationships, data semantics and consistency constraints. Data models define how data is connected to each other and how they are processed and stored inside the system.
Types of data models are:
- Entity relationship model
- Relational model
- Hierarchical model
- Network model
- Object oriented model
- Object relational model
- Entity Relationship Model
The entity relationship (E-R) model consists of a collection of basic objects, called entities and of relationships among these entities.
An entity can be real world object, either animate or inanimate, that can be easily identifiable. For example, in a school database, students, teachers, classes and courses offered can be considered as entities. Entities are represented by means of rectangles.
A relationship is an association among several entities. For example an employee works at a department, a student enrolls in a course. Here, works at and enrolls are called relationship. Relationships are represented by diamond-shaped box.
Entities are represented by means of their properties, called attributes. All attributes have values. For example, a student entity may have name, class, and age as attributes. Attributes are represented by means of ellipses. Every ellipse represents one attribute and is directly connected to its entity (rectangle).
The ER Model can be diagrammatically represented as follows:
Example of ER model
Let us consider an ER model for Banking system consisting of customers and accounts. The diagram shown below indicates that there are two entity sets, customer and account with attributes customer name, address, account no. and balance. In the diagram there is also a depositor between customer and account.
Advantages of ER model
- The E-R model gives graphical and diagrammatical representation of various entities, their attributes and relationships between entities. So, It helps in the clear understanding of the data structure and in minimizing redundancy and other problems.
- It is an effective communication tool among users, domain experts and database designers.
- Conversion of ER Diagram to any other data model like network model, hierarchical model and the relational model is very easy.
- ER model specifies mapping cardinalities.
- It is just used for database design and not for implementation.
- There is no industry standard notation for developing ER diagram.
- The E-R data model is especially popular for high level design.
- No representation of data manipulation.
- Physical design derived from E-R Model may have some amount of ambiguities or inconsistency.
- Relational Model
The relational database was invented by E. F. Codd at IBM in 1970.The relational model represents data and relationships among data by a collection of tables, each of which has a number of columns with unique names. Relational data model is used widely around the world for data storage and processing. This model is simple and it has all the properties and capabilities required to process data with storage efficiency.
For example the following figure shows a relational database showing customers and their accounts. The customer Nina has two accounts with Rs. 50000 and 30000 balance.
Table Name: Customer
Table Name : Account info
- The revision of any information as tables consisting of rows and columns is much easier to understand.
- In rational database, changes in the database structure do not affect the data access. So relational database has structural independence.
- The relational database model achieves both data independence and structural independence making the database design, maintenance, administration and usage much easier that the oher models.
- It is simpler to navigate
- A major constraint and therefore disadvantage in the use of relational database system is machine performance. If the number of tables between which relationships to be established are large and the tables themselves effect the performance in responding to the sql queries.
- Slower processing times than hierarchical and network models.