Database Management
Data:-
Data are the raw materials for information which are processed to get desired result. Data
can be text, audio, video, images or any combination of these. Data describes the
attributes of any real world object, which explains the feature behavior of that object.
There are many ways to collect data including surveys, interviews, questionnaire, reading
documents etc. In its raw form, data may or may not be useful to the decision maker.
Quite frequently data must be processed to become useful
Database:-
A collection of data stored in a standardized format designed to be processed, shared by
different users is called database
It is also defined as a collection of inter-related relevant data stored together to serve
multiple applications .A data may have single table or multiple table .The data in a
database are organized in rows and columns
- Rows are called records
- -Columns are called field or attributes
Information:-
Information is the output of data processing operation. When we process data
and convert it into a form that is useful to the decision-maker, it becomes information
Human beings apply facts, principles, knowledge, experience and intuition to convert
data into information .Information is time dependent since its values and usefulness often
decrease with time
DATABASE MANAGEMENT SYSTEM
It is software that defines a database, stores the data supports a query language, produce
reports and creates data entry form. It provides the data to the users which they ask for
In other words DBMS is an application programs that provides an interface between the
operating system and the user in order to make access to the data as simple as possible
Objectives of DBMS
a. To provide huge storage or space for relevant data
b. To allow easy access to the data for the user.
c. To provide quick response to user request for any information or data.
d. To allow updating with the latest modification in the database.
e. To remove duplicate data.
f. To allow multiple users to be active at one time.
g. To allow the growth of database system.
h. To provide maximum protection to data from any physical damage and
unauthorized access
Database Management System Page 1
ADVANTAGE AND DISADVANTAGE OF THE DATABASE MANAGEMENT
SYSTEM
Advantage of DBMS
2) It provides file sharing facilities
3) It reduced data redundancies and inconsistencies
4) It provides better service to the user
5) It improved the flexibility of the system
6) It provide and increased data Security
7) It improved data Integrity
8) It saved a great deal of programming time
9) It helps to prepare the report for particular requirement
10) It provides the facilities of obtaining information from the database
Disadvantage of DBMS
1) There is always a threat to confidentiality, privacy and security
2) It is very complex to understand and implement
3) It is always a costly matter to keep and maintain DBMS
4) In this system there are too many rules to follow up and remember
5) It is a fast changing technology and it is difficult to follow the changing
technology
6) It is difficult to maintain the quality of data
7) We need to maintain data integrity- as we have to always update our data
immediately which is very time consuming work
8) Lack of trained Manpower
DATABASE TERMS
Field: - A field is piece of information of an individual or an object such as person,
client, employee, book etc. this is the unit title of data record. Each unique type of
information is stored in its own field
For example: - In student_record Rollno, name, class address are called field
Record: - A record is complete information of an individual or an object such as person,
client, employee, book etc. A record can have much information under separate headings
called fields
For example: - In student _record all the information or complete information of one
student is called one record
Table: - A complete collection of records is called table. A table contains rows and
columns. Each column of a table is called field and each row is called record
For example: - Table: Student_record
Rollno Name Class Address Telephone Gender
1 Ram XI Baneshwor 9856454416 Male
2 Sita XI Maitidevi 014478493 Female
Database Management System Page 2
3 Suman XI Banasthali 014356789 Male
4 Sunita XI Sanepa 9851045678 female
In the above table Rollno, names are the field
And 1, ram, XI, baneshwor, 9856454416, male are completely called record
Key:- is field or column in a table that is used to uniquely identify records
In other words a key is an attribute whose values uniquely identify
each entity instance
For example: - An entity student can be uniquely identified by a roll no
An entity person can be uniquely identified by citizenship number
Primary key:-
Primary key is a field or column that uniquely identify records in a table
In other words primary key is that candidate key which will most
commonly be used uniquely to identify a single entity instance
For example: - In student record Roll no is the primary key
Alternate Key: An alternate key is any candidate key that is not the part of
primary key. Alternate keys are sometimes referred as secondary
keys
Candidate Key: A candidate key is a key that uniquely identifies record in a table.
Any of the identified candidate keys can be used as the table's
primary key.
Foreign key: - A field or column in one table that refers to the primary key field
in another table is called foreign key In other words foreign key
is a primary key of one entity that is contributed to another entity
to identify instances of a relationship
Define the following term:-
Domain: - Domain is a range of values from which the actual values appearing in
a given column are drawn. A domain describes the set of possible
values for a given attribute and can be considered a constraint on the
value of the attribute.
Schema: - A database schema is a logical description of each piece of data and its
relationship with other data elements.
Entity: - An entity is a class of a person place or an object
Attributes: - The characteristics of an entity is called attributes
Example: - roll, name address total etc
Tuple: A row in a relation (table) is called tuple.
Database Management System Page 3
Relationship: - A relationship is an association among several entities and
represents meaningful dependencies between them
Query:-
Query is to ask question about the data present in table. Using
query facility, we can view records or data, modify the content of
table, provide data sources to form and reports and lot more.
RELATIONSHIP
The association among two or more than two entities is called relationship.
There are all together three types of relationship they are fallows:-
a) One to one relationship:- A single instance of an entity is
associated with a single instance of another entity is known as
one to one relationship . For example:- one teacher teaching one
subject
b) One to many relationships:-An instance of an entity is
associated with several instances of another entity is known as
one to many relationships. For example:- teacher and students
c) Many to many relationship :- Many instances of an entity are
associated to many instances of another entity is known as many
to many relationship For example:- student and class ( A class
may contain many students and a student study in many classes)
RELATIONAL DATABASE SYSTEM AND NOM ALIZATION
Ans:- It is the DBMS in which relation between different tables can be formed
using a common field (which we called a key) Relational database implements
data in a series of two dimensional tables (tables having rows and column, rows
means record and column means field). RDBMS allows us to enter, store
manipulate and retrieve information organized into database table and sometime
which we called relation. IT also provides the interface between the user and the
data in the database.
Normalization is the process of presenting the database tables without any
duplication of information and simplification of tables without loss of
information. It can also be said that normalization is the process of organizing
data in a database to reduce the redundancies. The process of normalization
include both creating tables and establishing relationship between those tables
using rules designed to protect the data and to make the database more flexible.
Normalization is important in RDBMS because
1) It reduces the size of the database by breaking the table into two or more tables to
reduce the redundancy in the database
Database Management System Page 4
2) It simplifies and organize the table
3) It reduce the loss of information
4) It eliminates the repeating and conflicting data related to the same entity
5) It improves the performance of the system
6) It helps RDBMS to provides immediate response to user request of data
NORMALIZATION
The different types of Normalization are as follows:-
a. First Normal Form ( 1NF)
b. Second Normal Form (2NF)
c. Third Normal Form (3NF)
a) First Normal Form (1NF):- A table is said to be in First Normal Form if it contains
no repeating attributes or group of attributes.
b) Second Normal Form (2NF):- A table is said to be in Second Normal Form (2NF),
if it is in First Normal Form and no column that is not a part of primary key is
dependent on only a portion of the primary key.
c) Third Normal Form(3NF):- A table is said to be in Third Normal Form if it
contains no non-key dependencies
DATA MODEL
Data Model is a collection of conceptual tools for describing data, data relationships, data
semantics and data constraints. In other word data model is the method used inside the
database management system to organize the structure of the database.
The different types of data model are:-
a) Hierarchical Model
b) Network Model
c) Relational Model
a) Advantages and Disadvantages of Hierarchical Model
Advantages:-
i) It is the easiest model of database.
ii) A database owner is more secured because nobody else can see and
modify a child without consulting to its parents.
iii) Searching is very fast and easy, if parents is known.
iv) Very efficient in handling one-to-many relationship
Disadvantages:-
i) It is old fashioned, outdated database model.
ii) Modification and addition of child without consulting the parent is
impossible or very hard. So it is non flexible database model.
iii) Cannot handle many-to-many relationship.
iv) Increases redundancy because same is to be written in different places.
Database Management System Page 5
b) Advantages and Disadvantages of Network Database Model
Advantages:-
i) This model is more flexible than hierarchical model because it accepts
many-to-many relationships.
ii) It reduces redundancy because data should not be repeated.
iii) Searching is faster because of multidimensional pointers.
Disadvantages:-
i) It is very complex type of database model.
ii) It needs long programs to handle the relationship.
iii) Less security in comparison to hierarchical model because it is open to all.
c) Advantages and Disadvantages of Relational Database Model
Advantages:-
i) The rules implemented on one table can easily be implemented to another
table as one table is linked with other table with common key.
ii) It has very less redundancy (Unnecessary or duplicate data)
iii) Normalization of data is possible.
iv) Quick database processing is possible.
Disadvantages:-
i) It is complex than other models.
ii) It is confusing as many rules being applied.
DATA INTEGRITY
Data integrity refers to the validity of the data contained in a database. It is a rule that
must be followed by data in the database.
In other word data integrity means that data is accurate, consistent and
up to date. In DBMS if the data redundancy is reduced it increases the chance of data
integrity-the chances that the data is accurate, consistent and up to date. A database has
integrity if the data in it satisfy all established integrity constraints. A good DBMS should
provide an opportunity for users to build in these integrity constraints when they design
the database
There are three types of data integrity. They are-
a) Entity Integrity
b) Referential Integrity
c) Domain Integrity
a) Entity Integrity: - Entity integrity is the rule that no column that is part of the
primary key may accept null values. Entity integrity guaranteed that each record
will indeed have its own identity. The restriction that the primary key cannot
allow null values is called entity integrity.
b) Referential Integrity: - The referential integrity rule states that if table A
contains a foreign key that matches the primary key either must match the value
of the primary key for some row in table B or must be null.
c) Domain Integrity:-It specifies that all columns in relational database must be
declared upon a defined domain.
Database Management System Page 6
STARTING UP ACCESS
Click on the start button
Move the mouse to all programs
Make another move to Microsoft office and among the given Microsoft office
suites select Microsoft office access.
NB: IF INCASE YOU HAVE NOT SEEN MICROSOFT OFFICE, THEN RIGHT
CLICK ON THE EMPTY PART OF THE DESKTOP THEN MOVE THE
POINTER TO NEW AND CHOOSE ACCESS FROM THE GIVEN LIST OF
PROGRAMS.
When access is opened the following window will be displayed where you will select
what to use to
Create your database.
Creating a database from the scratch calls for clicking blank database option which will
make another window to appear as shown on the next page, so that you enter the database
name and click on create.
Database Management System Page 7
Upon clicking on create another window is displayed and this looks like this.
Enter the fields that you want to use by double clicking at the location written add
a new field.
Examples of fields include name, age course ….. But this will vary depending
with your type of database.
After entering your fields enter the records and save your table.
IMPORTANCE OF A DATABASE
It makes it easy to maintain and update data.
It offers a faster retrieval of information.
One can use a database to summarize reports from stored information.
It also offers easy analysation of information.
AREAS OF APPLICATION FOR A DATABASE
It is applied in budget analysis
For personal record maintenance
In making of address of books and diary maintenance.
Can as well be used in schools in storing students’ progress records.
COMPONENTS OF ACCESS DATABASE
Microsoft access has the following components.
1) TABLES
This is collection of related records. It must be created, defined and used to store database
information.
2) QUERIES
A database component of access that helps us to ask questions about data stored in tables.
3) FORMS
This is a collection of data that is chosen and written in a specific way.
4) REPORTS
This makes information that is organized and formatted to meet your specifications.
5) MACROS
Are a set of actions that are used to automate tasks that are performed on regular basis on
a database.
6) MODULES
Database Management System Page 8
Are used to automate a group of related procedures.
DATABASE TERMINOLOGIES
DATA
This is the stuff that you enter into the system to be stored, organized and maintained for
you.
FIELD
This is a place where data is entered within a table.
RECORDS
This makes a group of related fields.
TABLE
A collection of records describing similar data.
REQUIREMENTS FOR CREATING A DATABASE
Determine the purpose of your database.
Determine the tables you need in your database.
Determine the fields that you want to use in your table.
Identify the fields with unique values.
DATA TYPES
A data type is an attribute of a field that determines the kind of data a field will
store.
They include:
1) TEXT: - when used then it implies that the field will store a combination of texts
and numbers.
2) MEMO: - stores lengthy texts and numbers. It can hold up to 64000 characters of
information.
3) NUMBER: - this is a numeric data to be used in mathematical calculations except
for calculations involving money.
4) DATE AND TIME: - stores dates and time.
5) CURRENCY: - used when we are storing data with monetary values.
6) AUTONUMBER: - this is a unique sequential (increasing by 1) or random
numbers automatically inserted when a record is added.
7) YES/NO: - this is used in fields that will contain one of the two values such as
yes/no, true or false.
8) OLE (OBJECT LINKING AND EMBEDDING): - used to insert objects into a
database.
CREATING TABLES
This can be in table design or datasheet
CREATING A TABLE IN DESIGN VIEW
Click on home from the menu bar then on the view sector of the ribbon select
design view.
This produces the window below.
On the window enter the fields that you want in your table, the data types and the
description column is not mandatory to be filled.
Database Management System Page 9
1) Save your table then open it up so that you make entries into it.
CREATING A TABLE IN DATASHEET VIEW
1. After choosing blank database this view changes automatically and it looks as on
the next page.
i.
2. On the given window right click on the location written add new field so that you
enter the fields you need.
3. After entering your first field click below your field, on the interactive window
click ok then proceed with other fields.
CREATING A TABLE USING TEMPLATES
1. After opening access program
2. Click on local templates which exist to the left of the screen and among the
template displayed at the centre click on the one you want to use.
3. The selected template will be displayed to the right where you will click on create
then enter what you need.
4. Save your table upon completion.
QUERIES
This is a component of access database that is used in asking question about the
data stored in tables.
EXAMPLES OF QUERIES
1. To view a person details whose name starts in letter E just like my name, in a
given table, you will type E* at the criteria row below the field that contains the
name. Then you click on design from the menu bar and you make another click on
run. The run wizard looks like an exclamation mark and appears in red.
2. To view all the people that their name end in letter A, just like the last letter in my
name, we type *A at the criteria row below the respective field.
Database Management System Page 10
3. To view those that have letter I anywhere in their name, then we type *i*.
4. To view those that earn a salary more that 60,000 we type > 60,000
5. To view those that are not from Nairobi, we type not Nairobi.
6. Calculating basic pay in access BASIC PAY:[HOURS WORKED]*[RATE PER
HOUR]
USES OR QUERIES
1. Sorting records
2. Viewing records
3. Showing records
4. Calculations
CREATING QUERIES IN DESIGN VIEW
1. Click on create then make another click on query design.
2. This gives the window alongside
3. On this window select a table that you want to add then click on add.
4. After the table is added close the show table window and on the displayed
window, select all the fields and drop them on the fields sector below the location
where you had selected your fields.
5. Type your query then click on run.
FORMS
This is a collection of data that is chosen and written in a specific way.
These are used in representing either a table or query in a form format.
This can be created by several ways as follows.
Method 1
1. Click at what you want represented on a form at the navigation pane.
2. Make another click on create then click form. The form is displayed.
Method 2
Click on create from the menu bar then make another click
on form design.
This provides the following window that reminds me of
mathematics and some call it dhafu done on graph paper.
Don’t you fear even if Dhafu gave you difficulties for this
is just but a form.
Database Management System Page 11
From this window, drag what you want represented on your form from the
navigation pane and drop it on the working location.
Another window is displayed that look like the following.
On it click finish.
Close your form, save it then open to view the contents.
CREATING A FORM USING
FORM WIZARD
Form wizard provides a series of steps
that you can follow till your form is
displayed.
PROCEDURE
Click on create
from the menu bar then make another click on more forms.
On the provided options, select form wizard.
This produces the window on the next page.
Database Management System Page 12
On this window you will select the table or query you want represented on a form,
select the fields that you need then click on next.
Another window is produced as below where you will select the layout you want
to use then click next.
Upon clicking on next the following window is given where you will pick a style
for your form then click next.
The following window
gives two options and is
the last step where you
Database Management System Page 13
either open the form to view or enter information or modify the forms design.
Click finish when through.
REPORTS
This is used to
represent a table or
even a query on
a report wizard.
Creation of a report takes many ways which include creating directly, using
design or report wizard.
CREATING A REPORT DIRECTLY
Click on the item that you want represented on the report.
Click on create then click on report.
CREATING A REPORT ON DESIGN VIEW
PROCEDURE
Click on create then make another click on report design.
This displays the window below.
On this window drag and drop what you want represented on your report then
click finish and your report is displayed.
Close your report and save it then open it to view its look.
CREATING A REPORT WIZARD
1) Click on create then make another click on report wizard.
2) This produces the window below.
Database Management System Page 14
3) On the window select the query or table to be represented on your report.
4) Select the fields that you need on your report then click next.
5) This gives you another window whereby you are expected to sort and if
you do not want then click next.
6) The window appears as below.
7) After that click next
8) Another window is displayed as given on the next page, where you will
pick a layout for your report and orientation.
Database Management System Page 15
9) Make your selection then click next.
10) A gain you have another window. The steps look many but relax yourself
we are almost done.
11) On this window select a style that you need and click next. This gives you
the last window with two options.
12) You can choose to preview the report or modify the reports design.
13) Make a choice then click on finish and there you go your report is
displayed.
MACROS
These are a set of actions that are performed on regular basis on a database.
CREATING A MACRO
1) Click on create then make another click on macro.
2) From the options click macro, and choose macro and the remaining
procedures are but for your research. How about that?
REFERENCE COMMON QUESTION IN DATABASE
What is data security? How it can be implemented?
Ans:- Data security refers to the DBMS which can prevent unauthorized users from
viewing or updating the database. The protection of data from unauthorized access,
malicious destruction or by any kind of accidents is called data security. DBMS provides
data security to prevent the data from the losses or misuse.
In other words, data security means keeping data safe from the
various hazards to which it may be subjected. These include:-
a) Natural hazards such as fire, floods, hurricanes or earthquakes.
Database Management System Page 16
b) Illegal access to data by hackers
c) Accidental destruction of data by hardware failure or program or operator errors.
Data security can be implemented by adopting and maintaining the
following activities:-
Keeping data secure from fraudulent (fake) use or malicious (wicked) damage. Data may
be at risk not only from outside hackers but also from employees within the company, so
in order to tackle these risks, suitable measures should be taken.
i) Password protection
ii) User IDs and passwords
iii) Community security
iv) Data encryption
v) Physical
vi) Human
vii) Operating System
viii) Network
i) Password protection:- Most password schemes use tables to store the current
password for each authorized user.
ii) User IDs and passwords:- Each user in an organization who is permitted to
access a company database is issued with a user ID and a password, which
will normally give them a certain level of access rights set by the database
manager.
iii) Communication Security:- Telecommunication systems are defenseless to
hackers who discover a user Id and password and can gain entry to database
from their own computer. One way of preventing this is to use call-back
procedure so that when a remote user logs in, the computer automatically calls
the back at a pre-arranged telephone no to verify their access request before
allowing them to log in.
iv) Data Encryption:- Data encryption can also be used to scramble highly
sensitive or confidential data before transmission.
v) Physical:- The site or sits containing the computer systems must physically
secured against unauthorized entry by intruders ( one who enter without right).
vi) Human:- Users must be motivated just not to leak the password to
unauthorized person.
vii) Operating system:- It does not matter how secure the database system is, if
the operating system is weak then hackers can hack the database.
Network: - As we know that almost all database system allow remote access through
terminals or network. Software level security within the network software is important as
physical security
Write Short notes on:
Explain the term data dictionary in relation to database?
Database Management System Page 17
Ans: - Data dictionary is a sub- system of DBMS to keep track of the definition of
all the data items in the databases and helps the developers and users in finding
the necessary data. In other data dictionary is a master table which contains data
about all the databases in a database system. It is a valuable source of information
for end users and developers to find out what data is available, what the data
means and where and how to get it. The data stored in the data dictionary are also
called metadata or data about data. An example is MSACCESS holds data
dictionary as a set of system table called MSSYS object. Data dictionary contains
information such as:-
a. What table and column are included in the present structure
b. Name of current table and column
c. The characteristics of each item of data, such as its length and data
type
d. Any restriction on the values of certain columns.
e. The relationships between items of data
f. Which program access which item of data
What is SQL
SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to
communicate with a database.
According to ANSI (American National Standards Institute), it is the standard language
for relational database management systems. SQL statements are used to perform tasks
such as:
update data on a database, or retrieve data from a database.
Some common relational database management systems that use SQL are: Oracle,
Sybase, Microsoft SQL Server, Access, Ingres, etc. Although most database systems use
SQL, most of them also have their own additional proprietary extensions that are usually
only used on their system. However, the standard SQL commands such as "Select",
"Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost
everything that one needs to do with a database.
SQL:-SQL is a popular query language which is used in querying, updating and
managing relational databases. In other word SQL is a data access language designed for
managing data in relational database management systems (RDBMS).
SQL is a language designed to store data, but the data stored in an SQL database is not
static. It can be modified at any time with the use of several very simple commands. The
SQL syntax is pretty much self explanatory, which makes it much easier to read and
understand. It was developed by IBM in 1970 AD. It was first standardized in 1986.There
are about in SQL.
There are two type of SQL language (structured query language) they are:-
a) DDL language ( Data definition language)
b) DML language( Data manipulation language )
In DDL language there are all together three commands they are:-
a) Create command ( creating table )
Database Management System Page 18
b) Alter command
- Add ( adding column or field in table )
- Modify ( modifying the parameter of column)
- Drop ( dropping column from the table )
c) Drop command (dropping entire table form the database
In DML language there are all together four commands they are:-
a) Insert command ( This command is used for entering the data into the table)
b) Select command( This command is used for select required record for the
table )
c) Update record ( This command is used for calculating and modifying the
records in the table )
d) Delete command ( This command is used for deleting the record form the
table )
Data definition language (DDL):-It is the language which defines all attributes and
properties of a database, especially record layouts, field definitions, key fields, file
locations and storage capacity. Using this language the logical structure and the file
within the database may be defined. After compiling DDL statements we get a set of
table which is stored in data dictionary. Examples of DDL commands are CREATE,
ALTER and DROP.
Data manipulation language (DML):-It is the language which mainly does processing
and manipulating the data in the database. Actually the DML provides a comprehensive
set of command to allow modification of the data within a database. DML are often
capable of performing mathematical and statistical calculation that facilitates generating
reports. Example of DML commands are INSERT, SELECT, UPDATE and DELETE.
Data integrity is the overall completeness, accuracy and consistency of data. This can be
indicated by the absence of alteration between two instances or between two updates of a
data record, meaning data is intact and unchanged. Data integrity is usually imposed
during the database design phase through the use of standard procedures and rules. Data
integrity can be maintained through the use of various error-checking methods and
validation procedures.
Data integrity is enforced in both hierarchical and relational database models. The
following three integrity constraints are used in a relational database structure to achieve
data integrity:
Entity Integrity: This is concerned with the concept of primary keys. The rule
states that every table must have its own primary key and that each has to be
unique and not null.
Referential Integrity: This is the concept of foreign keys. The rule states that the
foreign key value can be in two states. The first state is that the foreign key value
would refer to a primary key value of another table, or it can be null. Being null
Database Management System Page 19
could simply mean that there are no relationships, or that the relationship is
unknown.
Domain Integrity: This states that all columns in a relational database are in a
defined domain.
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. If one of these features cannot be
implemented in the database, it must be implemented through the software
Database Management System Page 20