Database : Database is an organized collection of interrelated data stored in a computer.
Importance of Database:
• It gives us a highly efficient method for handling large amount of different types of data with ease.
• It allows large amount of data to be stored systematically and these data to be easily retrieved, filtered, sorted and updated efficiently and accurately.
Types of Database Model
Database Model: It determines the logical structure of a database and fundamentally determines in which manner data can be stored, organized and manipulated.
There are four common types of database model that are useful for different types of data or information. Depending upon your specific needs, one of these models can be used.
1. Hierarchical databases.
2. Network databases.
3. Relational databases.
4. Object-oriented databases.
1. Hierarchical databases
It is one of the oldest database model developed by IBM for information Management System. In a hierarchical database model, the data is organized into a tree-like structure. In simple language we can say that it is a set of organized data in tree structure.
This type of Database model is rarely used nowadays. Its structure is like a tree with nodes representing records and branches representing fields. The windows registry used in Windows XP is an example of a hierarchical database. Configuration settings are stored as tree structures with nodes.
The following figure shows the generalized the structure of Hierarchical database model in which data is stored in the form of tree like structure (data represented or stored in root node, parent node and child node).
The following figure shows the example of hierarchical database model for the university management system. This type of database employs the “parent-child” relationship of storing data.
• The model allows us easy addition and deletion of new information.
• Data at the top of the Hierarchy is very fast to access.
• It worked well with linear data storage mediums such as tapes.
• It relates well to anything that works through a one to many relationships. For example; there is a president with many managers below them, and those managers have many employees below them, but each employee has only one manager.
• It requires data to be repetitively stored in many different entities.
• Now a day there is no longer use of linear data storage mediums such as tapes.
• Searching for data requires the DBMS to run through the entire model from top to bottom until the required information is found, making queries very slow.
• This model support only one to many relationships, many to many relationships are not supported.
2. Network databases
This is looks like a Hierarchical database model due to which many time it is called as modified version of Hierarchical database. Network database model organised data more like a graph and can have more than one parent node. The network model is a database model conceived as a flexible way of representing objects and their relationships.
• The network model is conceptually simple and easy to design.
• The network model can represent redundancy in data more effectively than in the hierarchical model.
• The network model can handle the one to many and many to many relationships which is real help in modelling the real-life situations.
• The data access is easier and flexible than the hierarchical model.
• The network model is better than the hierarchical model in isolating the programs from the complex physical storage details.
• All the records are maintained using pointers and hence the whole database structure becomes very complex.
• The insertion, deletion and updating operations of any record require the large number of pointers adjustments.
• The structural changes to the database is very difficult.
3. Relational Database
A relational database is developed by E. F. Codd in 1970. The various software systems used to maintain relational databases are known as a relational database management system (RDBMS). In this model, data is organised in rows and column structure i.e., two-dimensional tables and the relationship is maintained by storing a common field. It consists of three major components.
In relational model, three key terms are heavily used such as relations, attributes, and domains. A relation nothing but is a table with rows and columns. The named columns of the relation are called as attributes, and finally the domain is nothing but the set of values the attributes can take. The following figure gives us the overview of rational database model.
Terminology used in Relational Model
• Tuple: Each row in a table is known as tuple.
• Cardinality of a relation: The number of tuples in a relation determines its cardinality. In this case, the relation has a cardinality of 4.
• Degree of a relation: Each column in the tuple is called an attribute. The number of attributes in a relation determines its degree. The relation in figure has a degree of 3.
Keys of a relation-
• Primary key- it is the key that uniquely identifies a table. It doesn’t have null values.
• Foreign key- it refers to the primary key of some other table.it permits only those values which appear in the primary key of the table to which it refers.
Some of the example of relational database are as follows.
Oracle: Oracle Database is commonly referred to as Oracle RDBMS or simply as Oracle. It is a multi-model database management system produced and marketed by Oracle Corporation.
MySQL: MySQL is an open-source relational database management system (RDBMS) based on Structured Query Language (SQL). MySQL runs on virtually all platforms, including Linux, UNIX, and Windows.
Microsoft SQL Server: Microsoft SQL Server is an RDBMS that supports a wide variety of transaction processing, business intelligence, and analytics applications in corporate IT environments.
PostgreSQL: PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance.
DB2: DB2 is an RDBMS designed to store, analyze, and retrieve data efficiently.
The following tables shows the sample relational database model for the bank environment where the data associated with the bank is stored in the form two dimensional tables.
• Relational model is one of the most popular used database model.
• In relational model, changes in the database structure do not affect the data access.
• The revision of any information as tables consisting of rows and columns is much easier to understand.
• The relational database supports both data independence and structure independence concept which makes the database design, maintenance, administration and usage much easier than the other models.
• In this we can write complex query to accesses or modify the data from database.
• It is easier to maintain security as compare to other models.
• Mapping of objects in relational database is very difficult.
• Object oriented paradigm is missing in relation model.
• Data Integrity is difficult to ensure with Relational database.
• Relational Model is not suitable for huge database but suitable for small database.
• Hardware overheads are incurred which make it costly.
• Ease of design can lead to bad design.
• Relational database system hides the implementation complexities and the physical data storage details from the users.
4. Object-oriented databases
An object database is a system in which information is represented in the form of objects as used in object-oriented programming. Object oriented databases are different from relational databases which are table-oriented. The object-oriented data model is based on the object-oriented- programming language concept, which is now in wide use. Inheritance, polymorphism, overloading. object-identity, encapsulation and information hiding with methods to provide an interface to objects, are among the key concepts of object-oriented programming that have found applications in data modelling. The object-oriented data model also supports a rich type system, including structured and collection types.
The following figure shows the difference between relation and object-oriented database model.
The following figure shows an example of object-oriented model.
• Object database can handle different types of data while relational data base handles a single data. Unlike traditional databases like hierarchical, network or relational, the object-oriented databases can handle the different types of data, for example, pictures, voice video, including text, numbers and so on.
• Object-oriented databases provide us code reusability, real world modelling, and improved reliability and flexibility.
• The object-oriented database is having low maintenance costs as compared to other model because most of the tasks within the system are encapsulated, they may be reused and incorporated into new tasks.
• There is no universally defined data model for an OODBMS, and most models lack a theoretical foundation.
• In comparison to RDBMSs the use of OODBMS is still relatively limited.
• There is a Lack of support for security in OODBMSs that do not provide adequate security mechanisms.
• The system more complex than that of traditional DBMSs.