INSTITUT D’ENSEIGNEMENT SUPÉRIEUR DE
RUHENGERI-INES-RUHENGERI
INSTITUTE OF APPLIED SCIENCES
FACULTY OF APPLIED FUNDAMENTAL SCIENCES (AFS)
DEPARTMENT OF COMPUTER SCIENCE(DCS)
Accredited by Ministerial Order N° 005/2010/MINEDUC of 16 June 2010
B.P. 155, Ruhengeri, Rwanda,
Tel.: +250 788 90 30 30, +250 788 90 30 32,
Email:
[email protected],
Website: www.ines.ac.rw
DATABASE MANAGEMENT SYSTEMS
Lecturer: NSENGIYUMVA Emmanuel
Computer Science Department, Level 2
31-May-2022
`
INDICATIVE CONTENT
Introduction: Concept & Overview of DBMS, Data Models, Database Languages, Database
Administrator, Database Users, Three Schema architecture of DBMS.
Entity-Relationship Model: Basic concepts, Design Issues, Mapping Constraints, Keys, Entity-
Relationship Diagram, Weak Entity Sets, Extended E-R features.
Relational Model: Structure of relational Databases, Relational Algebra, Relational Calculus,
Extended Relational Algebra Operations, Views, Modifications of the Database.
SQL and Integrity Constraints: Concept of DDL, DML, DCL. Basic Structure, Set operations,
Aggregate Functions, Null Values, Domain Constraints, Referential Integrity Constraints,
assertions, views, Nested Sub queries, Database security application development using SQL,
Stored procedures and triggers.
Relational Database Design : Functional Dependency, Different anomalies in designing a
Database., Normalization using functional dependencies, Decomposition, Boyce-Codd Normal
Form, 3NF, Normalization using multi-valued dependencies, 4NF, 5NF
Page |2
DATABASE MANAGEMENT SYSTEM
UNIT 1:
Introduction:
1. CONCEPT & OVERVIEW OF DBMS,
What is DBMS? Application,Types, Example,Advantages, Disadvantages
What is a Database?
A database is a collection of related data which represents some aspect of the real world. A
database system is designed to be built and populated with data for a certain task.
What is DBMS?
Database Management System (DBMS) is a software for storing and retrieving users' data
while considering appropriate security measures. It consists of a group of programs which
manipulate the database. The DBMS accepts the request for data from an application and
instructs the operating system to provide the specific data. In large systems, a DBMS helps users
and other third-party software to store and retrieve data.
DBMS allows users to create their own databases as per their requirement. The term “DBMS”
includes the user of the database and other application programs. It provides an interface
between the data and the software application.
Let us see a simple example of a university database. This database is maintaining information
concerning students, courses, and grades in a university environment. The database is organized
as five files:
The STUDENT file stores data of each student
The COURSE file stores contain data on each course.
The SECTION stores the information about sections in a particular course.
Page |3
The GRADE file stores the grades which students receive in the various sections
The TUTOR file contains information about each professor.
To define a database system:
We need to specify the structure of the records of each file by defining the different types
of data elements to be stored in each record.
We can also use a coding scheme to represent the values of a data item.
Basically, your Database will have 5 tables with a foreign key defined amongst the
various tables.
History of DBMS
Here, are the important landmarks from the history:
1960 - Charles Bachman designed first DBMS system
1970 - Codd introduced IBM'S Information Management System (IMS)
1976- Peter Chen coined and defined the Entity-relationship model also know as the ER
model
1980 - Relational Model becomes a widely accepted database component
1985- Object-oriented DBMS develops.
1990s- Incorporation of object-orientation in relational DBMS.
1991- Microsoft ships MS access, a personal DBMS and that displaces all other personal
DBMS products.
1995: First Internet database applications
1997: XML applied to database processing. Many vendors begin to integrate XML into
DBMS products.
Characteristics of Database Management System
Provides security and removes redundancy
Self-describing nature of a database system
Insulation between programs and data abstraction
Page |4
Support of multiple views of the data
Sharing of data and multiuser transaction processing
DBMS allows entities and relations among them to form tables.
It follows the ACID concept ( Atomicity, Consistency, Isolation, and Durability).
DBMS supports multi-user environment that allows users to access and manipulate data
in parallel.
Users in a DBMS environment
Following, are the various category of users of a DBMS system
Component Name Task
Application Programmers The Application programmers write
programs in various programming languages
to interact with databases.
Database Administrators Database Admin is responsible for managing
the entire DBMS system. He/She is called
Database admin
or DBA.
End-Users The end users are the people who
interact with the database management
system. They conduct various operations on
database like retrieving, updating, deleting,
etc.
Popular DBMS Software
Here, is the list of some popular DBMS system:
MySQL
Microsoft Access
Oracle
PostgreSQL
Page |5
dBASE
FoxPro
SQLite
IBM DB2
LibreOffice Base
MariaDB
Microsoft SQL Server etc.
Application of DBMS
Sector Use of DBMS
Banking For customer information, account
activities, payments, deposits, loans, etc.
Airlines For reservations and schedule information.
Universities For student information, course
registrations, colleges and grades.
Telecommunication: It helps to keep call records, monthly bills,
maintaining balances, etc.
Sales Use for storing customer, product &
sales information.
Manufacturing It is used for the management of supply
chain and for tracking production of items.
Inventories status in warehouses.
HR Management For information about employees, salaries,
payroll, deduction, generation of
paychecks, etc.
Page |6
Finance: For storing information about stock, sales, and purchases of financial
instruments like stocks and bonds.
Education, Hospitals, Business, Security, etc
DBMS Database Models
A Database model defines the logical design and structure of a database and defines how data
will be stored, accessed and updated in a database management system. While the Relational
Model is the most widely used database model, there are other models too:
Hierarchical Model
Network Model
Entity-relationship Model
Relational Model
Hierarchical Model
This database model organises data into a tree-like-structure, with a single root, to which all the
other data is linked. The heirarchy starts from the Root data, and expands like a tree, adding child
nodes to the parent nodes.
In this model, a child node will only have a single parent node.
This model efficiently describes many real-world relationships like index of a book, recipes etc.
In hierarchical model, data is organised into tree-like structure with one one-to-many relationship
between two different types of data, for example, one department can have many courses, many
professors and of-course many students.
Page |7
Network Model
This is an extension of the Hierarchical model. In this model data is organised more like a graph,
and are allowed to have more than one parent node.
In this database model data is more related as more relationships are established in this database
model. Also, as the data is more related, hence accessing the data is also easier and fast. This
database model was used to map many-to-many data relationships.
This was the most widely used database model, before Relational Model was introduced.
Page |8
Entity-relationship Model
In this database model, relationships are created by dividing object of interest into entity and its
characteristics into attributes.
Different entities are related using relationships.
E-R Models are defined to represent the relationships into pictorial form to make it easier for
different stakeholders to understand.
This model is good to design a database, which can then be turned into tables in relational
model(explained below).
Let's take an example, If we have to design a School Database, then Student will be
an entity with attributes name, age, address etc. As Address is generally complex, it can be
another entity with attributes street name, pincode, city etc, and there will be a relationship
between them.
Relational Model
In this model, data is organised in two-dimensional tables and the relationship is maintained by
storing a common field.
This model was introduced by E.F Codd in 1970, and since then it has been the most widely used
database model, infact, we can say the only database model used around the world.
Page |9
The basic structure of data in the relational model is tables. All the information related to a
particular type is stored in rows of that table.
Hence, tables are also known as relations in relational model.
In the coming tutorials we will learn how to design tables, normalize them to reduce data
redundancy and how to use Structured Query language to access data from tables.
P a g e | 10
DATABASE LANGUAGES,
Database languages are used to read, update and store data in a database. There are several such
languages that can be used for this purpose; one of them is SQL (Structured Query Language).
Types of DBMS languages:
Data Definition Language (DDL)
DDL is used for specifying the database schema. It is used for creating tables, schema, indexes,
constraints etc. in database. Lets see the operations that we can perform on database using DDL:
To create the database instance – CREATE
To alter the structure of database – ALTER
To drop database instances – DROP
To delete tables in a database instance – TRUNCATE
To rename database instances – RENAME
P a g e | 11
To drop objects from database such as tables – DROP
To Comment – Comment
All of these commands either defines or update the database schema that’s why they come under
Data Definition language.
Data Manipulation Language (DML)
DML is used for accessing and manipulating data in a database. The following operations on
database comes under DML:
To read records from table(s) – SELECT
To insert record(s) into the table(s) – INSERT
Update the data in table(s) – UPDATE
Delete all the records from the table – DELETE
Data Control language (DCL)
DCL is used for granting and revoking user access on a database –
To grant access to user – GRANT
To revoke access from user – REVOKE
In practical data definition language, data manipulation language and data control languages are
not separate language, rather they are the parts of a single database language such as SQL.
Transaction Control Language(TCL)
The changes in the database that we made using DML commands are either performed or
rollbacked using TCL.
To persist the changes made by DML commands in database – COMMIT
To rollback the changes made to the database – ROLLBACK
P a g e | 12
DATABASE ADMINISTRATOR,
What is a Database Administrator?
A database administrator is someone who uses software to store and organize data, such as
financial information and customer shipping records. They make sure that data is available to users
and is secure from unauthorized access. Database administrators work in many different types of
industries, including computer systems design and related services firms, insurance companies,
banks, and hospitals.
What does a Database Administrator do?
Database administrators, often called DBAs, make sure that data analysts can easily use the
database to find the information they need and that the system performs as it should. DBAs
sometimes work with an organization’s management team to understand the company’s data needs
and to plan the goals of the database.
Database administrators often plan security measures, making sure that data is secure from
unauthorized access. Many databases contain personal or financial information, making security
important. Database administrators are responsible for backing up systems in case of a power
outage or other disaster. They also ensure the integrity of the database, guaranteeing that the data
stored in it comes from reliable sources.
DBAs must be able to monitor a database system’s performance to determine when action is
needed. They must be able to evaluate complex information that comes from a variety of sources.
Most database administrators work on teams and must be able to communicate effectively
with developers, managers, and other workers.
Working with databases requires an understanding of complex systems, in which a minor error can
cause major problems. For example, mixing up a customer's credit card information can cause
someone to be charged for a purchase he or she didn’t make. Database administrators use software
to make sense of information and to arrange and organize it into meaningful patterns. The
P a g e | 13
information is then stored in the databases that these workers administer, test, and maintain. When
problems with a database arise, administrators must be able to diagnose and correct them.
Some responsibilities of a database administrator include:
Identifying user needs to create and administer databases
Ensuring that the database operates efficiently and without error
Making and testing modifications to the database structure when needed
Maintaining the database and updating permissions
Merging old databases into new ones
Backing up and restoring data to prevent data loss
Many database administrators are general-purpose DBAs and have all these duties. However, some
DBAs specialize in certain tasks that vary with the organization and its needs.
Two common specialties are as follows:
-System DBAs are responsible for the physical and technical aspects of a database, such as
installing upgrades and patches to fix program bugs. They typically have a background in system
architecture and ensure that the database in a firm’s computer system works properly.
-Application DBAs support a database that has been designed for a specific application or a set of
applications, such as customer service software. Using complex programming languages, they may
write or debug programs and must be able to manage the aspects of the applications that work with
the database. They also do all the tasks of a general DBA, but only for their particular application.
DATABASE USERS,
Database users are the one who really use and take the benefits of database. There will be
different types of users depending on their need and way of accessing the database.
P a g e | 14
End Users
End users are the people whose jobs require access to a database for querying, updating and
generating reports.
Application user
The application user is someone who accesses an existing application program to perform daily
tasks.
Sophisticated user
Sophisticated users are those who have their own way of accessing the database. This means they
do not use the application program provided in the system. Instead, they might define their own
application or describe their need directly by using query languages. These specialized users
maintain their personal databases by using ready-made program packages that provide easy-to-
use menu driven commands, such as MS Access.
Application Programmers
These users implement specific application programs to access the stored data. They must be
familiar with the DBMSs to accomplish their task.
Database Administrators (DBA)
This may be one person or a group of people in an organization responsible for authorizing
access to the database, monitoring its use and managing all of the resources to support the use of
the entire database system.
P a g e | 15