Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

CHAPTER # 13

DATABASE MANAGEMENT SYSTEM

What is Database?
Database also called electronic database, any collection of data or information, that is specially
organized for rapid search and retrieval by a computer. Databases are structured to facilitate the
storage, retrieval, modification, and deletion of data in conjunction with various data-
processing operations. A database is a collection of related files within an organization. An
organization has more than one database consisting of related files.

What is Database Management System DBMS?


A database management system DBMS is a software package that allows the user to create,
maintain and manipulate a database to produce useful information. The DBMS is software which
represents the interface between the user and computer’s operating system and database.
The most popular DBMS software are SQL, Oracle, MS Access and dBase etc.

Character:
The basic building block of data is a character. A character sometimes called byte consist of letters
(A a, B b, C c..., Z z) numeric digits (0, 1, 2 … 9) or symbols (!, @, #, $, %, &, *).

Entity:
An entity can be a 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. All these entities have some attributes or properties that give them their
identity.
An entity set is a collection of similar types of entities. An entity set may contain entities with
attribute sharing similar values. For example, a Students set may contain all the students of a
school; likewise a Teachers set may contain all the teachers of a school from all faculties. Entity
sets need not be disjoint.

Figure : 1 Figure : 2
In Fig 1 Employees, Customers, Orders are Entities.

Fields OR Attributes:
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.
There exists a domain or range of values that can be assigned to attributes. For example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc. Each attribute or field have data type which is represent the type of data item. Most
common data field are text field, numeric field, currency field, logical field, date field and memo
field.

Key Fields:
A key is a data item that allows us to uniquely identify individual occurrences or an entity type.
You can sort and quickly retrieve information from a database by choosing one or more fields (i.e.
attributes) to act as keys. For instance, in a student's table you could use a combination of the last
name and first name fields (or perhaps last name, first name and birth dates to ensure you identify
each student uniquely) as a key field.
Several important keys are given below:
1. Primary Key
2. Secondary Key
3. Foreign Key
4. Simple Key
5. Compound Key
6. Composite Key (Highlighted keys are included in your XII course).

Primary Key:
A primary key consists of one or more attributes that distinguishes a specific record from any other.
For each record in the table the primary key acts like a driver's license number or a national
insurance number, only one number exists for each person.
For example, your student number is a primary key as this uniquely identifies you within the
college student records system. An employee number uniquely identifies a member of staff within
a company. An IP address uniquely addresses a PC on the internet.
A primary key is mandatory. That is, each entity occurrence must have a value for its primary key.

Secondary Key:
An entity may have one or more choices for the primary key. Collectively these are known as
candidate keys. One is selected as the primary key. Those not selected are known as secondary
keys. For example, an employee has an employee number, a National Insurance (NI) number and
an email address. If the employee number is chosen as the primary key then the NI number and
email address are secondary keys. However, it is important to note that if any employee does not
have a NI number or email address (i.e. : the attribute is not mandatory) then it cannot be chosen
as a primary key.

Foreign Key:
A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another
table or the same table. In simpler words, the foreign key is defined in a second table, but it refers
to the primary key or a unique key in the first table. For example, a table called Employee has a
primary key called employee_id. Another table called Employee Details has a foreign key which
references employee_id in order to uniquely identify the relationship between both tables.

Record:
A record is a collection of related fields (Sometimes called a row). Data is stored in records. A
record is composed of fields and contains all the data about one particular person, company, or
item in a database. In this database, a record contains the data for one customer. Records appear
as rows in the database table. A record for Log ID 1201242 is highlighted in Figure.
File:
A file is a collection of related records. The term may refer to a computer file that contains any
type of data, including a word processing document or spreadsheet. It may also refer to a database
file that contains records, such as orders and customers.

Advantages Of Database Management System (DBMS):


Advantages of DBMS are give below:

1) Improved Data Sharing:


The DBMS helps create an environment in which end users have better access to more and
better-managed data. Such access makes it possible for end users to respond quickly to changes
in their environment.

2) Improved Data Security:


The more users access the data, the greater the risks of data security. Companies invest
considerable amounts of time, effort, and money to make sure that corporate data are used
properly. A DBMS provides a framework for better application of data privacy and security
policies.

3) Improved Data Access:


The DBMS makes it possible to produce quick answers according to queries. From a database
perspective, a query is a specific request issued to the DBMS for data manipulation or handling
—for example, to read the data. Simply put, a query like (Select * from xyztable) all records of
xyztable shown. The DBMS sends back an answer (called the query result set) to the application.
4) Increased User Productivity:
The availability of data, combined with the tools that changes data into usable information, to
allow end users to make data handling quick and easy to use, informed decisions that can make
the difference between success and failure in the global economy.

5) Improvement Of Data Integrity:


Data integrity is the maintenance of, and the assurance of the accuracy and consistency of data.
The concept of data integrity ensures that all data in a database can be traced and connected to
other data. This ensures that everything is recoverable and searchable. Having a single, well-
defined and well-controlled data integrity system increases stability, performance, reusability
and maintainability.

6) Program Independence:
With a DBMS, the program and file formats are same, so that one programmer or even several
programmers can spend less time to maintain files.

Disadvantages of Database Management System (DBMS):


Disadvantages of DBMS are give below:

1) Increase Cost (Cost Issue):


Database systems require sophisticated hardware and software. The cost of maintaining the
hardware, software required to operate and manage a database system can be meaningful.
Training, licensing, and rule compliance costs are often overlooked when database systems are
implemented.

2) Security Issues:
Database can be structured to restrict access, it’s always possible that unauthorized user will get
past the safeguards. In addition, if a database is destroyed by fire and any natural disaster, theft
and hardware/software problem.

3) Privacy Issues:
Database have all important and most private record of each employee or person, person can’t
share the data with any other like Medical report and other type of personal information which
is used for employee evaluation.

4) New Hardware Required:


Every DBMS has a basic CPU requirement, meaning a CPU version and minimum processor
speed required for the DBMS to operate. Additionally, some DBMSs specify hardware models
that are required or unsupported. Usually the CPU criterion will suffice for an Intel environment,
but in a mainframe or enterprise server environment the machine model can make a difference
with regard to the DBMS features supported. For example in super mart, a hardware use named
Bar Code Reader (BCR) which enters the data in database.
Objectives Of DBMS:
The designers of DBMS are faced with a number of challenges. Their software must provide users
with concrete and worthwhile benefits to justify the expense and efforts associated with installing
it. Some important objectives are given below:

1) Efficient Use Of Resources:


A DBMS should function efficiently given the current computer resources of the installation. It
should not require the user to add expensive new hardware or software to make it work, and it
should not waste storage, space or processing time in the performance of designated task.

2) Speed:
A DBMS must run fast enough to provide replies to user’s questions within an applicable time
frame. Many systems are now very interactive (like user ask query or question, DBMS response
immediate) so the speed is primary or basic objective.

3) Compatibility:
A DBMS must interface easily with existing hardware, software and data if it is to be installed
successfully. In addition, DBMS should support the hardware and software of the system and
user friendly too.

4) Efficient Update Of Data:


A DBMS must allow for the quick and efficient addition and deletion of data records and
categories. It must so easy to handle changes to or rearrangement of the data in its database.

5) Accessibility:
The purpose of DBMS is that easy to learn query language that allows the user to ask a wide
verity of questions about the data without having to prepare specially designed application
programs. For example (select * from employees) so DBMS show all records of employees
table etc.

6) Data Integrity:
Data integrity means the security, maintenance and consistency of data. The database is a place
where all information is store. Data integrity is one most important objective of DBMS, because
that tells how well it secure data integrity.

7) Privacy & Security:


One of the major concerns of database is privacy & security, because database contains
information and the privacy as well as security of data should mandatory. A major objective of
any DBMS is to limit access to authorized user. Because database kept very sensitive or
confidential type of data for example medical records, bank records, credit files and military
record etc.
Components Of Database Management System:
To create, gain access to, and modify the database, the special software known as the DBMS is
required. A DBMS may have few components including:
(1) Query language
(2) Data dictionary
(3) Utilities
(4) Report generator
(5) Access security
(6) Data recovery

1) Query Language:
Structured query languages support database searching and other operations by using
commands such as “find,” “delete,” “print,” “sum,” and so forth. The sentence like structure of
a query resembles natural language except that its syntax is limited and fixed. Almost all DBMS
have same query language. DDL (Data definition language) have facilities for describing the
structure of fields, records, file and program accessing rights. Whereas DML (Data
manipulating language) is used for accessing and update records and files contained within
database, DBMS contain both DDL and DML features.
For Example: select std_ID from Student where Fees < 1000

2) Data Dictionary:
All DBMS include a data dictionary. Which is a software component that store the data
definition of the structure of data used in the database. A data dictionary also maintains data
integrity because as data is entered, the dictionary checks it to make sure that it confirms to the
rules define during data definition such as field name, field size, type of data (text, numeric,
date etc).

3) Utilities:
The DBMS utilities are program that enables users to maintain the database. This includes such
task as:
a) Creating and maintaining the data dictionary.
b) Removing records flagged for deletion. DBMS must have built-in protection to prevent user
from accidently/ by mistake deleting records. To delete unwanted records from the database.
c) Monitoring performance.
d) Preventing data corruption when multiple user attempt to access the dame database
simultaneously.

4) Report Generator:
The report generator aspect of DBMS software simplifies the process of generating an on
screen or print out report. Its only readable report on short notice. In report specify the format
of the report in advance row headings, column heading, page header etc.

5) Access Security:
Access security is a feature of DBMS that allow database administrators (DBA) to specify
different access privilege for different users of DBMS. For instance, some user might be
allowed only to retrieve (view) data, whereas another might have the right to update and
delete records.

6) System Recovery:
Some advance DBMS have a system recovery feature, which enable the DBA (Data base
administrator) to recover content of the database in the event of a hardware or software
failure.

The Basic Database Model:


A database model is a type of data model that determines the logical structure of a database and
fundamentally determines in which manner data can be stored, organized, and manipulated. The
most popular example of a database model is the relational model, which uses a table-based
format. The most popular models are:
1) Hierarchical database model.
2) Network database model.
3) Relational database model.

1) Hierarchical Database Model


In the hierarchical database model, data is organized or arrange into related groups much
like a family tree, with low level and high level records. A low level record is called a child
and high level records are called a parent. The parent record at the top of the database is
called root record.
In this model may have more than one child, but a child has only one parent. This is called
one-to-many relationship. To find any record we should start searching from the parent
record of the database to child records of the database.

2) Network Database Model:


The network model is very similar to the hierarchical model actually. In fact, the hierarchical
model is a subset of the network model. However, instead of using a single-parent tree
hierarchy, the network model uses set theory to provide a tree-like hierarchy with the
exception that child tables were allowed to have more than one parent. This allowed the
network model to support many-to-many relationships.
Visually, a Network Database looks like a hierarchical Database in that you can see it as a
type of tree. However, in the case of a Network Database, the look is more like several trees
which share branches. Thus, children can have multiple parents and parents can have multiple
children.

This example shows the network model of “Store Database”.

3) Relational Database Model:


A relational database is a digital database whose organization is based on the relational model
of data, as proposed by E. F. Codd in 1970. The various software systems used to maintain
relational databases are known as a relational database management system (RDBMS).
Virtually all relational database systems use SQL (Structured Query Language) as the
language for querying and maintaining the database. Relational model are popular because
the data within each of the separate files can be combined to produce a wide range of queries
and reports. One of the major advantages of relational database is that there is no parent or
child. This means that relationships among records in different tables are not predetermined
by the structure of the database. Relational database system provide a high degree of
flexibility and data independence.
There are three types of relations in DBMS:

One-to-one relationship:
For each record in one table, there is one and only one matching record in a different table. It is
as if two tables have the exact same primary key. Typically, data from different tables in a one-
to-one relationship will be combined into one table.

One-to-many relationship:
For each record in one table, there may be zero, one or many records matching in a separate
table. For example, you might have an invoice header table related to an invoice detail table. The
invoice header table has a primary key, Invoice Number. The invoice detail table will use the
Invoice Number for every record representing a detail of that particular invoice. This is certainly
the most common type of relationship you will encounter.

Many-to-many relationship:
Used decidedly less often, this relationship cannot be defined in Access without the use of a
mapping table. This relationship states that records in both tables can have any number of
matching records in the other table.

Referential integrity is a relational database concept, which states that table relationships must
always be consistent. In other words, any foreign key field must agree with the primary key that
is referenced by the foreign key.
A feature provided by relational database management systems (RDBMS's) that prevents users
or applications from entering inconsistent data. Most RDBMS's have various referential integrity
rules that you can apply when you create a relationship between two tables.
For example, suppose Table B has a foreign key that points to a field in Table A. Referential
integrity would prevent you from adding a record to Table B that cannot be linked to Table A. In
addition, the referential integrity rules might also specify that whenever you delete a record from
Table A, any records in Table B that are linked to the deleted record will also be deleted. This is
called cascading delete. Finally, the referential integrity rules could specify that whenever you
modify the value of a linked field in Table A, all records in Table B that are linked to it will also
be modified accordingly. This is called cascading update.

Objects of Database:

MS Access uses “objects" to help the user list and organize information, as well as prepare
specially designed reports. When you create a database, Access offers you Tables, Queries, Forms,
Reports, Macros, and Modules. Databases in Access are composed of many objects but the
following are the major objects.
1. Tables
2. Queries
3. Forms
4. Reports
Together, these objects allow you to enter, store, analyze, and compile your data. Here is a
summary of the major objects in an Access database

Table
Table is an object that is used to define and store data. When you create a new table, Access asks
you to define fields which is also known as column headings.

 Each field must have a unique name, and data type.

 Tables contain fields or columns that store different kinds of data, such as a name or an
address, and records or rows that collect all the information about a particular instance of
the subject, such as all the information about a customer or employee etc.

 You can define a primary key, one or more fields that have a unique value for each record,
and one or more indexes on each table to help retrieve your data more quickly.

Query
An object that provides a custom view of data from one or more tables. Queries are a way of
searching for and compiling data from one or more tables.

 Running a query is like asking a detailed question of your database.

 When you build a query in Access, you are defining specific search conditions to find
exactly the data you want.

 In Access, you can use the graphical query by example facility or you can write Structured
Query Language (SQL) statements to create your queries.

 You can define queries to Select, Update, Insert, or Delete data.

 You can also define queries that create new tables from data in one or more existing tables.

Form
Form is an object in a desktop database designed primarily for data input or display or for control
of application execution. You use forms to customize the presentation of data that your application
extracts from queries or tables.

 Forms are used for entering, modifying, and viewing records.

 The reason forms are used so often is that they are an easy way to guide people toward
entering data correctly.

 When you enter information into a form in Access, the data goes exactly where the database
designer wants it to go in one or more related tables.

Report
Report is an object in desktop databases designed for formatting, calculating, printing, and
summarizing selected data.

 You can view a report on your screen before you print it.

 If forms are for input purposes, then reports are for output.

 Anything you plan to print deserves a report, whether it is a list of names and addresses, a
financial summary for a period, or a set of mailing labels.

 Reports are useful because they allow you to present components of your database in an
easy-to-read format.

 You can even customize a report's appearance to make it visually appealing.

 Access offers you the ability to create a report from any table or query.

Other MS Access Objects


Let us now take a look at other MS Access objects.

Macro
This object is a structured definition of one or more actions that you want Access to perform in
response to a defined event. An Access Macro is a script for doing some job. For example, to create
a button which opens a report, you could use a macro which will fire OpenReport action.

 You can include simple conditions in macros to specify when one or more actions in the
macro should be performed or skipped.

 You can use macros to open and execute queries, to open tables, or to print or view reports.
 You can also run other macros or Visual Basic procedures from within a macro.

 Data macros can be attached directly to table events such as inserting new records,
editing existing records, or deleting records.

 Data macros in web apps can also be stand-alone objects that can be called from
other data macros or macro objects.

odule
Module is an object in desktop databases containing custom procedures that you code
using Visual Basic. Modules provide a more discrete flow of actions and allow you to
trap errors.

 Everything that can be done in a macro can also be done in a module, but you don't
get the macro interface that prompts you what is needed for each action.

 Modules are far more powerful, and are essential if you plan to write code for a
multi-user environment, because macros cannot include error handling.

 Modules can be standalone objects containing functions that can be called from
anywhere in your application, or they can be directly associated with a form or a
report to respond to events on the associated form or report.

You might also like