Data Models A model is a representation of reality, µreal world¶ objects and events, and their associations. It is an abstraction that concentrates on the essential, inherent aspects of an organization. Data Model can be defined as an integrated collection of concepts for describing and manipulating data, relationships between data, and constraints on the data in an organization.

A data model comprises of three components: y A structural part, consisting of a set of rules according to which databases can be constructed. y A manipulative part, defining the types of operation that are allowed on the data (this includes the operations that are used for updating or retrieving data from the database and for changing the structure of the database).

y Possibly a set of integrity rules, which ensures that the data is accurate.

The purpose of a data model is to represent data and to make the data understandable. There have been many data models proposed in the literature. They fall into three broad categories:

y y y

Object Based Data Models Physical Data Models Record Based Data Models

The object based and record based data models are used to describe data at the conceptual and external levels, the physical data model is used to describe data at the internal level.

Object Based Data Models Object based data models use concepts such as entities, attributes, and relationships. An entity is a distinct object (a person, place, concept, event) in the organization that is to be represented in the database. An attribute is a property that describes some aspect of the object that we wish to record, and a relationship is an association between entities. Some of the more common types of object based data model are: y y Entity²Relationship Object Oriented

y The Entity-Relationship model has emerged as one of the main techniques for modeling database design and forms the basis for the database design methodology. The object oriented data model extends the definition of an entity to include, not only the attributes that describe the state of the object but also the actions that are associated with the object, that is, its behavior.

The three most widely accepted record based data models are: y y y Hierarchical Model Network Model Relational Model .Physical Data Models Physical data models describe how data is stored in the computer. There are not as many physical data models as logical data models. and access paths. they are used to specify the overall logical structure of the database and to provide a higher-level description of the implementation. representing information such as record structures. record ordering. In contrast to object based data models. Record Based Logical Models Record based logical models are used in describing data at the logical and view levels. the most common one being the Unifying Model.

dating from late 1950s. One of the first hierarchical databases Information Management System (IMS) was developed jointly by North American Rockwell Company and IBM. . This model is like a structure of a tree with the records forming the nodes and fields forming the branches of the tree.Hierarchical Model Hierarchical Database model is one of the oldest database models.



Sample Database .


Operations on Hierarchical Model Insert Operation: Update Operation: Delete Operation: .

so we obtain only a single record for P2. a loop is constructed to search all suppliers under this part and supplier numbers are printed for all suppliers. since parent occurs only once in the whole database. first we search the information of parent P2 from database. . Then.Record Retrieval: Record retrieval methods for hierarchical model are complex and asymmetric which can be clarified with the following queries: Query1: Find the supplier number for suppliers who supply part P2. Solution: In order to get this information.

.Algorithm get [next] part where PNO=P2. do until no more shipments under this part. Query2: Find part numbers for parts supplied by supplier S2. get next supplier under this part. Solution: In order to get required part number we have to search S2 under each part. otherwise we go to next part until all the parts are searched for supplier S2. If supplier S2 is found under a part then the corresponding part number is printed. print SNO. end.

end. if found then print PNO. . We have placed square brackets around ³next´ in those statements where we expect at the most one occurrence to satisfy the specified conditions. Since both the queries involved different logic and are complex. for the initial case we assume it to be just prior to the first row of the table). get next part.Algorithm do until no more parts. In above algorithms ³next´ is interpreted relative the current position ( normally the row most recently accessed. so we can conclude that retrieval operation of this model is complex and asymmetric. get [next] supplier under this part where SNO=S2.

using data whose relationships are fixed. .Advantages of Hierarchical Model Simplicity: Data Security: Data Integrity: Efficiency The hierarchical database model is a very efficient one when the database contains a large number of 1: N relationships (one-to-many relationships) and when the users require large number of transactions.

Lack of structural independence: Structural independence exists when the changes to the database structure does not affect the DBMS¶s ability to access data. So the application programs should have a good knowledge of the relevant access paths to access the data. Programs Complexity: .Disadvantages of Hierarchical Model Implementation Complexity: Database Management Problems: If you make any changes in the database structure of a hierarchical database. Hierarchical database systems use physical storage paths to navigate to the different data segments. then you need to make the necessary changes in all the application programs that access the database.

The manyto-many (N:N) relationships. hierarchical model suffers from the Insert anomalies. Implementation Limitation: Many of the common relationships do not conform to the 1:N format required by the hierarchical model. Update anomalies and Deletion anomalies. .Operational Anomalies: As discussed earlier. thus hierarchical model is not suitable for all the cases. also the retrieval operation is complex and asymmetric. which are more common in real life are very difficult to implement in a hierarchical model.

Network Model The Network model replaces the hierarchical tree with a graph thus allowing more general connections among the nodes. 1:M (one:many). Suppose an employee works for two departments. is its ability to handle many to many (N:N) relations. In network database terminology. . a relationship is a set. it allows a record to have more than one parent. The main difference of the network model from the hierarchical model. A network structure thus allows 1:1 (one:one). The strict hierarchical arrangement is not possible here and the tree becomes a more generalized graph ± a network. In other words. Each set is made up of at least two types of records: an owner record (equivalent to parent in the hierarchical model) and a member record (similar to the child record in the hierarchical model). M:M (many:many) relationships among entities. The network model was evolved to specifically handle non-hierarchical relationships.

Network view of Sample Database .

Operations on Network Model Insert Operation .


Update Operation: Delete operation: .


.For example if supplier S1 stops the supply of part P1 with 250 quantity the model is modified without affecting P1 and S1 information.

Then for each connector we check the supplier over that connector and supplier number for the concerned supplier record occurrence is printed as shown in below algorithm. P2 we will get only one occurrence of P2 from the entire database. first we search for the required part i. Then a loop is constructed to visit each connector under this part i. In order to understand this consider the following example queries: Query 1.e.Retrieval Operation: Record retrieval method for network model are symmetric but complex.e. P2. . Find supplier number for suppliers who supply part P2. Solution: In order to retrieve the required information.

.Algorithm get [next] part where PNO=P2. Find part number for parts supplied by supplier S2. print SNO. S2 and we will get only one occurrence of S2 from the entire database. Then a loop is constructed to visit each connector under this supplier i. Then for each connector we check the part over that connector and part number for the concerned part record occurrence is printed as shown in below algorithm. Query 2. In order to retrieve the required information. get next connector under this part. end. First we search for the required supplier i.e. S2. same procedure is adopted.e. get supplier over this connector. do until no more connectors under this part.

we can conclude that network model does not suffers from the Insert anomalies. Update anomalies and Deletion anomalies. get part over this connector. also the retrieval operation is symmetric. which makes whole model complicated and complex. print PNO. Since each above operation involves the modification of pointers. as compared to hierarchical model. Conclusion As explained earlier. get next connector under this supplier. end. do until no more connectors under this supplier.Algorithm get [next] supplier where SNO=S2. but the main disadvantage is the complexity of the model. .

.Advantages of Network Model Conceptual simplicity: Capability to handle more relationship types: The network model can handle the one-to-many (1:N) and many to many (N:N) relationships. which is a real help in modeling the real life situations. Data Integrity: The network model does not allow a member to exist without an owner. This ensures the data integrity. Thus a user must first define the owner record and then the member record. Ease of data access: The data access is easier than and flexible than the hierarchical model.

Data independence: The network model is better than the hierarchical model in isolating the programs from the complex physical storage details. All the network database management systems conformed to these standards. These standards included a Data Definition Language (DDL) and the Data Manipulation Language (DML). . thus greatly enhancing database administration and portability. Database Standards: One of the major drawbacks of the hierarchical model was the nonavailability of universal standards for database design and modeling. The network model is based on the standards formulated by the DBTG and augmented by ANSI/SPARC (American National Standards Institute/Standards Planning and Requirements Committee) in the 1970s.

which makes its implementation very complex and complicated. network model¶s insertion. Absence of structural independence: Since the data access method in the network database model is a navigational system.Disadvantages of Network Model System complexity: All the records are maintained using pointers and hence the whole database structure becomes very complex. Operational Anomalies: As discussed earlier. making structural changes to the database is very difficult in most cases and impossible in some cases. deletion and updating operations of any record require large number of pointer adjustments. If changes are made to the database structure then all the application programs need to be modified before they can access data. .

The relational model consists of three major components: 1. a researcher of IBM in the year 1960s. Integrity rules that define the procedure to protect the data (data integrity). 2. A relational model database is defined as a database that allows you to group its data items into one or more independent tables that can be related to one another by using fields common to each related table.F. This concept purposed by Dr. E. The operations that can be performed on data (data manipulation). 3.Relational Model Relational model stores data in the form of tables. Codd. The set of relations and set of domains that defines the way data can be represented (data structure). .

a concept known as closure. That is.Characteristics of Relational Database The whole data is conceptually represented as an orderly arrangement of data into rows and columns. called a relation or table. ¨ All values are scalar. ¨ All operations are performed on an entire relation and result is an entire relation. . at any given row/column position in the relation there is one and only one value.

the relation has a cardinality of 4. The relation in has a degree of 3. In this case. .Basic Terminology used in Relational Model Tuples of a Relation Cardinality of a relation The number of tuples in a relation determines its cardinality. Degree of a relation Each column in the tuple is called an attribute. The number of attributes in a relation determines its degree.

Domains are often confused with data types. but this is inaccurate. ³Number´ is a data type and ³Age´ is a domain. they belong to different domains. a domain is the set of all possible values that an attribute may validly contain. Data type is a physical concept while domain is a logical one. but they are obviously different kinds of text fields. To give another example ³StreetName´ and ³Surname´ might both be represented as text fields. More particularly.Domains A domain definition specifies the kind of data represented by the attribute. .

for a table to qualify as a relation each record must be uniquely identifiable and the table must contain no duplicate records. For example: Supplier number in S table is primary key. by definition. Second a relation with no tuples still qualifies as a relation. Some different types of keys are Primary key is an attribute or a set of attributes of a relation which posses the properties of uniqueness and irreducibility (No subset should be unique). uniquely identifiable. First the relation is unordered. There are some important concepts here. a relation is a set. The items in a set are.Body of a Relation The body of the relation consists of an unordered set of zero or more tuples. A key is the relational means of specifying uniqueness. Part number in P table is primary key and the combination of Supplier number and Part Number in SP table is a primary key . Therefore. Third. Keys of a Relation It is a set of one or more columns whose combined values are unique among all occurrences in a given table. Record numbers do not apply to relations.

Foreign key is the attributes of a table. which is the primary key of S table. which is the primary key of P table. Foreign key permit only those values. which appears in the primary key of the table to which it refers or may be null (Unknown value). For example: SNO in SP table refers the SNO of S table. which refers to the primary key of some another table. . so we can say that SNO in SP table is the foreign key. so we can say that PNO in SP table is the foreign key. PNO in SP table refers the PNO of P table.

Operations in Relational Model Insert Operation: .

Update Operation: .

Delete Operation: .

Record Retrieval: Query1: Find the supplier numbers for suppliers who supply part P2. end. Solution: In order to get this information we have to search the information of part P2 in the SP table (shipment table). . print SNO. For this a loop is constructed to find the records of P2 and on getting the records. get next shipment where PNO=P2. Algorithm do until no more shipments. corresponding supplier numbers are printed.

both the queries involve the same logic and are very simple. . Since. so we can conclude that retrieval operation of this model is simple and symmetric. end. Algorithm do until no more parts. get next shipment where SNO=S2.Query2: Find part numbers for parts supplied by supplier S2. For this a loop is constructed to find the records of S2 and on getting the records corresponding part numbers are printed. Solution: In order to get this information we have to search the information of supplier S2 in the SP table (shipment table). print PNO.

we can say that structural independence have been achieved. implementation. When it is possible to make change to the database structure without affecting the DBMS¶s capability to access data. changes in the database structure do not affect the data access. So. Conceptual simplicity: Design. maintenance and usage ease: Ad hoc query capability: The presence of very powerful. The query language of the relational database models structured query language or SQL makes ad hoc queries a reality.Advantages and Disadvantages of Relational Model Structural independence: In relational model. relational database model has structural independence. flexible and easy-to-use query capability is one of the main reasons for the immense popularity of the relational database model. SQL is a fourth generation language (4GL). .

Disadvantages of Relational Model The drawbacks of the relational database systems could be avoided if proper corrective measures are taken. The drawbacks are not because of the shortcomings in the database model. but the way it is being implemented. Hardware overheads: Ease of design can lead to bad design: µInformation island¶ phenomenon: .


Another Case Study ‡ Customer-Loan database (m:m type relationship) .




Comparison of Data Models .





the widely preferred one is the relational data model. Among the traditional data models. since it eliminates the need to change the application programs when a change is made to the database. Security and integrity are maintained easily by relational data model. End users need not know the exact physical structure of a table or relation.Which Data Model to Use? a model that best suits an organization depends on the following factors: ‡The organization¶s primary goals and requirements. use of relational model for database design increases the productivity of application programs. Also. . ‡The volume of daily transactions that will be done. relational tables show only the logical relationship. ‡The estimated number of enquiries that will be made by the organization. Moreover. This is because relational model can be used for representing most of the real world objects and the relationships among them.

. hierarchical model suffers from lot of anomalies it is useful only for those cases which are hierarchical in nature. Since.Network Model is also free from anomalies but due to its complex nature it is not a preferred model.

Sign up to vote on this title
UsefulNot useful