A database is a collection of related information about a subject organized in a useful manner that provides a base or foundation for procedure, such as retrieving information, drawing conclusion and make decision.
A database is a collection of interrelated data of certain place or person or things in such a way that it can be easily access by an application program like DBMS.
A DBMS is a set of programs that manages the database files. The DBMS allows accessing the files, updating the records, and retrieving data as requested. The DBMS acts as an interface between the application program and the data in the database. Examples : Microsoft Access,Oracle, MySQL, SQL Server etc.
Why Database ?
Traditional file system have been used from the beginning for managing data in a computer . In the traditional file system, the data can be duplicated, they cannot be shared and security and integrity cannot be maintained very well. It is also very difficult to search data. So it is not easy to work in file system where everything is kept in file.
Problems with File system.
a. Data Duplication
b. Data dependence
c. Lack of data integration
DBMS ( Database Management System)
A DBMS is a set of programs that manages the database files. The DBMS allows to access the files. Update the records, and retrieve data as requested. The DBMS acts as an interface between the application program and the data in the database.
Objectives of DBMS
• To provide storage area for mass amount of relevant data.
• To make access to the data easy for the end user.
• To provide prompt response to users request for data
• To make the latest modification to the database available immediately.
• To eliminate data redundancy (duplication of data)
• To allow multiple user to be active at one time
• To protect the data from the physical harm and unauthorized access.
Advantage of DBMS
1. Data Sharing: Data stored in a database can be share. For example with a DBMS the data for the entire company is effectively made available to all managers and end users, which need them
2. Reduced data Redundancy: In traditional file processing the same data may be duplicated at many times or places is also called data redundancy. A DBMS reduces the duplication of data from a database.
3. Integrity can be maintained: Integrity ensures that the data stored in a database is correct or accurate. So the problem of integrity is the problem of ensuring that the data in the database is correct.
4. Data Independence: The DBMS keeps description of data separate from application that use the data. Thus changes in the data definition can occur without requiring changes in every application program that uses the data.
5. Security can be enforced: In an organization, there should be many confidential data, such data should not be available to all users. In a DBMS, certain restriction can be applied for security by giving different authority to different users.
6. Providing multiple user interface: DBMS provides variety of interfaces for various users.
Disadvantage of DBMS
1. Initial investment is high for implementing DBMS
2. Proper training is require for staff to work properly in the database system
3. When some fault occurs in one part of the database it affects the other parts as well.
4. It is complex to understand and implement
5. Overhead cost for providing security, recovery, and integrity functions.
6. Cost for the maintenance of the hardware, software, backup, recovery and its upgrade remains forever.
Data model describes the structure of a database. Data model is collection of conceptual tools for describing data, relationship etc.
Types of Database Model
1. Hierarchical Database Model
In a hierarchical database model records are logically organized into a hierarchy of relationships. It is arranged logically in an inverted tree patterns. It is based on parent child. A parent record can have several children,, but a child can have only one parent.
• A hierarchical database model is a data model in which the data is organized into a tree-like structure.
• The hierarchical data model is the oldest type of data model, developed by IBM in 1968.
• Records are inter-related through hierarchical or tree-like structures.
• A parent can have several children, but a child can have only one parent.
• One to one and one to many relationships.
• It is the easiest model of database.
• A database owner is more secured because nobody else can see and modify a child without consulting its parent.
• Searching is fast and easy, if parent is known.
• It is very efficient in handling 'One-to-many' relationship.
• It helps to build complex system from simple components.
• It is old fashioned, outdated database model.
• It is non-flexible database model (Modification and addition of child without consulting the parent is impossible or very complex process).
• It can't handle 'Many- to-Many' relationships.
• It increases data redundancy as same data can be saved in different places.
• When parent node is deleted, all the children nodes are deleted automatically.
2. Network Data Model
• Network Database Model Network database model is a modified version of the hierarchical database.
• In network database structure each node may have several parents.
• Operation and maintenance of this structure becomes complicated, as the number of points in the network increases.
• It is less user-friendly when compared to the hierarchical structure.
• It Support Many to Many Relationship
• It is more flexible than hierarchical model because accepts 'many-to-many' relationship.
• It reduces redundancy because data shouldn't be repeated if same data is needed.
• Searching is fast because of multidirectional pointers.
• It is one of the complex database models.
• It needs larger programs to handle the relationships.
• It is less secured compared to hierarchical model, as it is open to all.
3. Entity Relation Data Model
• The ER data models is based on a perception of real world that consist of a collection of basic objects called entities and relationship among these objects.
• Database can be modeled as a collection of entities, and relationship among entities.
• Overall logical structure of a database can be expressed graphically by E-R diagram.
Basic Component of Diagram
• Rectangle (represent entity sets)
• Ellipses (represents attributes)
• Diamonds (represent relationship sets among entity sets)
• Lines (link attributes to entity sets and entity sets to relationship sets)
4. Relational Database Model
In a relational Database model, data are arranged in two dimensional table, which are easy for a user to develop and understand. This type of model can also be described mathematically. Because many managers often work with tabular form data, it is easy for most of them to understand the structure used in a relational database.
• Since on table is linked with other, some common fields and rules implemented on one table can easily be implemented to another.
• It is very less data redundancy
• Normalization of the database is possible
• Rapid processing of database is possible
• It is more complex than other models
• Too many rules makes database non-user-friendly
Language that are used to interact with database management systems are called database language. DBMS provides two languages:
Data Definition Language (DDL)
Database language that is used to create, delete or modify database schema is called data definition language. Results of DDL Statements are recorded in special file called data dictionary. Structured query language supports following DDL Statements.
• Create Statement
• Drop Statement
• Alter Statement
Eg. CREATE TABLE account
Account-number CHAR (10)
Branch CHAR (10)
Data Manipulation Language (DML)
Database language that enables insert, delete, update and retrieve data from database is called data manipulation language (DML). Query language is only a part of data manipulation language. Structured Query Language (SQL) supports following DML statements.
• Insert statement
• Delete Statement
• Update Statement
• Select Statement
Eg. Insert into Employee values (“A01”, 7676, “Patan”);