You are on page 1of 6

1

Database
Database:-
Database is an organized collection of related data that is stored in an efficient
and compact manner.
The word organized means that data is stored in such a way that the user can use
this data easily. The word related means that a database is normally created to
store the data about a particular topic.

For example if a database is created for students, it will contain data about the
students such as roll no, name, address etc. Similarly, if the database is about the
employees of an organization, it will contain the data of employees such as
employees ID, grade and salary etc. All data in database is arranges in tables.

The word efficient means that the user can search the required data quickly. The
word compact means that the stored data occupies as little space as possible in
computer.

Tables:-
Table is the fundamental object of the database structure. The basic purpose
of a table is to store data. A table consists of rows and columns. A table is a very
convenient way to store data. The data in tables can be manipulated easily.

Serial No Name Qualification Email


1 Usman B.SC. usman@yahoo.com
2 Abdullah M.SC. Abdullah@yahoo.com
3 Ejaz M.SC. ejaz@yahoo.com
Table: Records table.

Rows/Record:-
Rows are the horizontal part of the table. It is a collection of related fields.
For example, the above table has three rows. Each row contains a record of
different person.

2 Abdullah M.SC. Abdullah@yahoo.com


A single row/ record

Columns/ Field:-
Columns are the vertical part of the table, For example, all values in the
above table under “Name” field make a column.
2
Name
Usman
Abdullah
Ejaz

A single column

Examples of Databases:-
Following are some important examples of databases:

1. Phone Directory:-
Phone directory is a simple example of a database. A phone
directory stores the phone numbers of different persons. Searching a
phone number from phone directory is very easy as all phone
numbers are stored in an organized way.
2. Library:-
A library contains thousands of books. It is very difficult to handle
the records of all these books without database. A database system
can be used to store the records of books, search the required books
easily. This database can help for doing research work.
3. College:-
A college has many students in different classes. A database may be
used to keep the records of the students, fee transactions,
examination information and other data of the college. It can also
store the attendance of the students.

Database Management System:-


A database Management system (DBMS) is a collection of programs
that are used to create and maintain a database. DBMS is a general-purpose
software system that provides the following facilities:

1. It provides the facility to define the structure of database. The user can
specify data types, format and constraints for the data to be stored in
database.
2. It provides the facility to store data on some storage medium controlled by
DBMS.
3. It provides the facilities to insert, delete, update and retrieve specific data to
generate reports etc.

Components of Database Environment:-


The important components of a database environment are as follows:
3

1. Repository:-
A repository is a collection of all data definitions, data relationships, output
styles and report formats etc. All this information is the metadata that is
important to manage database.
2. Database Management System:-
A database management system (DBMS) is a collection of programs that
are used to create and maintain a database.
3. Database:-
Database can be defined as an organized collection of related data. The
word “organized” means that data is stored in such a way that user can
store, manipulate and retrieve data easily.
4. Application Program:-
An application program is program that is used to send commands to the
database management system to manipulate database. These commands are
sent to the DBMS through graphical user interface. The user interface with
the application program and the application program further interacts with
the database management system. Two important application programs are
developer 2000 and power Builder.
5. User Interface:-
The user interface is a visual environment that is used to communicate with
the computer. It consists of menus, buttons and other components. All
windows based software use graphical user interface. The user interface
consists of following components. It will contain forms, menus and reports.
6. Data Administrators:-
Data administrators are the persons who are responsible of whole
information system. They authorize access to the database as well as
coordinate and monitor the use of database.
7. System Analysts and Application Programmers:-
System analysts determine the requirements of end users and develop
specifications for transactions. Application programmers implement these
specifications and programs.
8. End User:-
End users are those persons who interact with the application directly. They
are responsible to insert, delete and update data in the database. They get
information from the system as and when required.

Database Approach:-
Database approach has many advantages over file processing system.

1. Redundancy Control:-
The data in a database appears only once and is not duplicated. For
example the data of a student in college database is stored in one table.
The table can be accessed for different purposes. For examples, if we
4
want to store the marks of student in a table, only roll No of the student
will be used in second table. The second table will be connected to the
student table for accessing the information about the student as follows:

Student Table
Roll No Name Address Email Phone
1 Usman Faisalabad usman@yahoo.com 727253
2 Abdullah Faisalabad Abdullah@yahoo.com 784692

Marks Table
Roll No Subjects Marks
1 Math 98
1 English 87
2 Math 81
2 English 92

In the above figure, the details of the students are stored in student table. The
marks table stores only the Roll No of students. The remaining data is not
duplicated. Roll No in the Marks table is duplicated for joining two tables.

2. Data Consistency:-
An important benefit of controlling redundancy is that the data is
consistent. If a data item appears only at one place, It is easy to maintain. If it is
required to update data the updating is performed at only one place. The change
will automatically take effect at all places where ever this data is used.

3. Consistency Constraints:-
Consistency constraints are the rules that must be followed to enter data in
database. If the constraints are not fulfilled, data cannot be entered in database.
Database Management systems provide an easy way to apply different consistency
to ensure data consistency. For example, a constraint can be applied to ensure that
the data is always entered in a specific range etc.

4. Data Atomicity:-
A collection of all steps to complete a process is known as transaction. Data
atomicity means that either a transaction should take place as a whole or it should
not take place at all. It ensures that the database will always have correct and
consistent data. Suppose a user wants to transfer money from account A to account
B. This process consists of two steps:
1. Deduct the money from account A.
2. Add the money to account B.
Suppose that the system fails when the computer has performed the first step. It
means that the amount has been deducted from account A but has not been added
to account B. This situation can make data inconsistent. The database management
5
system does not allow such a situation to happen. Database management system
either executes both steps or does not execute any step.

5. Data Security:-
Data security is the protection of the database from unauthorized access.
The database management system provides several procedures to maintain data
security. The security is maintained by allowing access to the database through the
use of passwords. Not every use of database system should be able to access all
the data.
In some situations, it is required to provide different types of access
permission to data for different users. For example, a data entry operator should
only be allowed to enter data. The chairman of the organization should be able to
access or delete the data completely. Database management system provides
different levels of security options for different users.

Disadvantages of Database Approach:-


Some disadvantages of using database approach are as follows:

1. High Cost of DBMS:-


A Complete database management system is very large and sophisticated
software. It is expensive to purchase database management software.
2. Higher Hardware Cost:-
Database management systems are complicated and heavy soft wares.
Additional memory and processing power may be required to run the DBMS.
It may require more powerful hardware.
3. Higher Programming Cost:-
DBMS is complex software with many features. The programmers need a
thorough knowledge of system to use it to best advantage. If the organization
hires experienced database programmers, it has to pay extra cost for this
expertise.
4. High Conversion Cost:-
If an organization converts its records to database, data has to be converted
from files to database system. Because of the different formats used by
different systems, it may be a difficult and time-consuming process. Moreover,
the structure and data may also have to be modified according to the
requirements of DBMS.
5. More Chance of Failure:-
In database management system, all resources and components are centralized.
If any of these components fails, the whole system stops.
6. Complexity & Performance:-
Database management system is general-purpose software. A complete DBMS
has to perform many tasks that make it complex and complicated software. In
6
some applications, DBMS may run less efficiently as compared to file
processing system.

Difference between File and Database Approach:-


The difference between File and Database approach is as follows:
File-based approach Database approach
1. The programs and data are 1. The programs and data are
interdependent. independent of each other.
2. The data may be duplicated in 2. The data is not duplicated and
different files that cause data appears only once.
redundancy.
3. The same data in different file may 3. The data appear only once so it is
be different that creates inconsistency. always consistent.
4. The data is separately stored in 4. The data is stored in tables which are
various files and it is different for linked together. The applications can
application to retrieve the appropriate retrieve the required data easily.
data.
5. The data is distributed in many 5. The data is stored at one place and
different files and cannot be shared. can be shared easily.
6. It is difficult to apply data integrity 6. Database approach provides many
checks on files. constraints for data integrity.
7. It provides poor security as the data is 7. It provides many procedures to
widely spread. maintain data security.
8. It is difficult to maintain as it 8. It provides many facilities to
provides less controlling facilities. maintain the programs easily.
9. It is less complex system. 9. It is very complex system.
10. The cost is very less than DBMS. 10. The cost is much more than file
system.
11. One application can fail without 11. All application relying on database
affecting the others. fails if the database fails.