Monday, April 27, 2015

DBMS models

Conceptually, there are three broad options with regard to data­base models. These are:
a. Hierarchical model
b. Network model
c. Relational model

(a) Hierarchical model:

This model presents data to users in a hierarchy of data elements that can be represented in a sort of inverted tree. In a sales order processing system, a customer may have many invoices raised to him and each invoice may have dif­ferent data elements. Thus, the root level of data is customer, the second level is invoice and the last level is line items such as in­voice number, date, product, quantity, etc.
This structure is quite natural when seen from the event point of view. However, the lower levels are owned by higher level data elements, and elements at the same level have no linkage at all. As a result, the query such as what products are purchased by which customer, in the above example, shall be difficult to carry out in the hierarchical struc­ture.
The query as to which customer purchased which product would be convenient. Thus, where there are many-to-many rela­tionships between two entities, this model would not be appropri­ate. Figure 9.4 shows the hierarchical model of data for a sales order processing application.
clip_image002

(b) Network model:

In the network model of database, there are no levels and a record can have any number of owners and also can have ownership of several records. Thus, the problem raised above in the sales order processing will not arise in the network model.
As there is no definite path defined for retrieval of data, the number of links is very large and thus network databases are complex, slow and difficult to implement. In view of the difficulty in implementation, network model is used only when all other options are closed.
The typical ex­ample of a network database may be the employee and the depart­ment he/she has worked or can work with in future. Figure 9.5 shows the network model of data for an employee information system.
clip_image003

(c) Relational model:

The most recent and popular model of data­base design is the relational database model. This model was devel­oped to overcome the problems of complexity and inflexibility of the earlier two models in handling databases with many-to-many rela­tionships between entities.
These models are not only simple but also powerful. In the relational database, each file is perceived as a flat file (a two dimensional table) consisting of many lines (records), each record having key and non-key data item(s). The key item(s) is the data element(s) that identifies the record. Figure 9.6 shows the files, and the fields that each record shall have in a customer invoicing system.
clip_image005
In these files, the key data items are customer id, invoice no, and product code. Each of the files can be used separately to gener­ate reports. However, data can also be obtained from any combina­tion of files as all these files are related to each other with the help of key data items specified above.
This is the fundamental advan­tage of the relational model of database along with its simplicity and the robustness.