NATIONAL INSTITUTE OF TRANSPORT
DEPARTME
NT CCT
Basic Database Management System–
ITT 04205
Prepared R . Mero
By:
Date: 10/02/2023
Lectures
We will meet for Lecture in the time as specified in the institute
Timetable,
Take note of the course outline
Lectures will be interactive. This means:
You will need to study the new material before every lecture (slides, book,
and online material)
You may be chosen in class to explain the material to your classmates
© 2023 National Institute of Tran 2
sport
Grading
Test 1 & 2 20%
Individual & Group
Assignments 20%
Final exam 60%
Total 100%
© 2023 National Institute of Tran 3
sport
Class Activities/Quiz
It will involve:
Applying what we learned in class in that particular day
It will be completed individually
© 2023 National Institute of Tran 4
sport
Policies
You may discuss homework problems with classmates, after you have
made a serious effort in trying the homework on your own.
You can use ideas from the literature (with proper citation).
You can use anything from the textbooks/notes.
© 2023 National Institute of Tran 5
sport
1.1 WHY DATABASES?
Keep record of:-
Customers, products, Employees, Debtors/Creditors and
All business operations for decision making
Depending on the type of information system and the characteristics of
the business, these data could vary from a few megabytes on just one or
two terabytes
How can these businesses process this much data?
How can they store it all, and then quickly retrieve just the facts that
decision makers want to know, just when they want to know it?
The answer is that they use databases.
© 2023 National Institute of Tran 6
sport
1.2 DATA VS. INFORMATION
To understand what drives database design, you must understand the
difference between data and information
Data are raw facts. The word raw indicates that the facts have not yet
been processed to reveal their meaning
Data is a collection of a distinct small unit of information. It can be used
in a variety of forms like text, numbers, media, bytes, etc. it can be
stored in pieces of paper or electronic memory, etc.
Information is the result of processing raw data to reveal its meaning.
© 2023 National Institute of Tran 7
sport
DATA VS. INFORMATION…
Data constitute the building
blocks of information.
Information is produced by
processing data.
Information is used to reveal
the meaning of data.
Accurate, relevant, and
timely information is the key
to good decision making.
Good decision making is the
key to organizational survival
in a global environment.
© 2023 National Institute of Tran 8
sport
1.3 INTRODUCING THE DATABASE
Efficient data management typically requires the use of a computer
database.
A database is a shared, integrated computer structure that stores a
collection of:
End-user data, that is, raw facts of interest to the end user.
Metadata, or data about data, through which the end-user data are
integrated and managed. OR
A database is an organized collection of data, so that it can be easily
accessed and managed.
© 2023 National Institute of Tran 9
sport
Database Management System
• Database management system (DBMS) is a software
which is used to manage the database. E.g.
MySQL, Oracle, MS Access etc. OR
• A database management system (DBMS) is a collection of
programs that manages the database structure and
controls access to the data stored in the database
• DBMS provides an interface to perform various operations like
database creation, storing data in it, updating data, creating a
table in the database and a lot more.
• It provides protection and security to the database. In the
case of multiple users, it also maintains data consistency.
© 2023 National Institute of Tran 10
sport
DBMS allows users to perform the following tasks:
Data Definition: It is used for creation, modification, and removal of
definition that defines the organization of data in the database.
Data Updation: It is used for the insertion, modification, and deletion
of the actual data in the database.
Data Retrieval: It is used to retrieve the data from the database which
can be used by applications for various purposes.
User Administration: It is used for registering and monitoring users,
maintain data integrity, enforcing data security, dealing with
concurrency control, monitoring performance and recovering
information corrupted by unexpected failure.
© 2023 National Institute of Tran 11
sport
Database Applications Examples
Enterprise Information
Sales: customers, products, purchases
Accounting: payments, receipts, assets
Human Resources: Information about employees, salaries, payroll
taxes.
Manufacturing: management of production, inventory, orders, supply
chain.
Banking and finance
customer information, accounts, loans, and banking transactions.
Credit card transactions
Finance: sales and purchases of financial instruments (e.g., stocks
and bonds; storing real-time market data
Universities: registration, grades
© 2023 National Institute of Tran 12
sport
Database Applications Examples (Cont.)
Airlines: reservations, schedules
Telecommunication: records of calls, texts, and data
usage, generating monthly bills, maintaining balances on
prepaid calling cards
Web-based services
Online retailers: order tracking, customized
recommendations
Online advertisements
Document databases
Navigation systems: For maintaining the locations of
varies places of interest along with the exact routes of
roads, train systems, buses, etc.
© 2023 National Institute of Tran 13
sport
7.2 File System
A file can be understood as a container to store data in a computer.
Files can be stored on the storage device of a computer system.
Contents of a file can be texts, computer program code, comma
separated values(CSV), etc.
Likewise, pictures, audios/videos, web pages are also files.
Files stored on a computer can be accessed directly and searched for
desired data.
But to access data of a file through software, for example, to display
monthly attendance report on school website, one has to write
computer programs to access data from files.
© 2023 National Institute of Tran 14
sport
Continuing the example of attendance at school, we need to store data
about students and attendance in two separate files. Table 7.1 shows
the contents of STUDENT file which has six columns, as detailed below:
RollNumber – Roll number of the student
SName – Name of the student
SDateofBirth – Date of birth of the student
GName – Name of the guardian
GPhone – Phone number of the student guardian
GAddress – Address of the guardian of the student
© 2023 National Institute of Tran 15
sport
STUDENT file maintained by office staff
© 2023 National Institute of Tran 16
sport
file called ATTENDANCE which has four columns, as detailed below
AttendanceDate – Date for which attendance was
marked
RollNumber – Roll number of the student
SName – Name of the student
AttendanceStatus – Marked as P (present) or A
(absent)
© 2023 National Institute of Tran 17
sport
ATTENDANCE file maintained by class teacher
© 2023 National Institute of Tran 18
sport
Limitations of a File System
File system becomes difficult to handle when number of files increases
and volume of data also grows. Following are some of the limitations of
file system:
(A) Difficulty in Access
Files themselves do not provide any mechanism to
retrieve data. Data maintained in a file system are
accessed through application programs. While writing
such programs, the developer may not anticipate all the
possible ways in which data may be accessed. So,
sometimes it is difficult to access data in the required
format and one has to write application program to
access data. © 2023 National Institute of Tran 19
sport
(B) DataRedundancy
Redundancy means same data are duplicated in
different places (files). In our example, student names
are maintained in both the files.
Besides, in Table students with roll numbers 3 and 5
have same guardian name and therefore same
guardian name is maintained twice. Both these are
examples of redundancy which is difficult to avoid in a
file system. Redundancy leads to excess storage use
and may cause data inconsistency also.
© 2023 National Institute of Tran 20
sport
(C) Data Inconsistency
Data inconsistency occurs when same data maintained
in different places do not match. If a student wants to
get changed the spelling of her name, it needs to be
changed in SName column in both the files.
Likewise, if a student leaves school, the details need to
be deleted from both the files. As the files are being
maintained by different people, the changes may not
happen in one of the files. In that case, the student
name will be different (inconsistent) in both the files
© 2023 National Institute of Tran 21
sport
(D) Data Isolation
Both the files presented at Table 1 (STUDENT) and at Table 2
(ATTENDANCE) are related to students. But there is no link or
mapping between them.
The school will have to write separate programs to access these
two files. This is because data mapping is not supported in file
system. In a more complex system where data files are generated
by different person at different times, files being created in
isolation may be of different formats.
In such case, it is difficult to write new application programs to
retrieve data from different files maintained at multiple places, as
one has to understand the underlying structure of each file as well.
© 2023 National Institute of Tran 22
sport
(E) Data Dependence
Data are stored in a specific format or structure in a file. If
the structure or format itself is changed, all the existing
application programs accessing that file also need to be
change. Otherwise, the programs may not work correctly.
© 2023 National Institute of Tran 23
sport
(F) Controlled Data Sharing
There can be different category of users like teacher,
office staff and parents. Ideally, not every user should
able to access all the data.
As an example, guardians and office staff can only see
the student attendance data but should not be able to
modify/delete it.
It means these users should be given limited access
(read only) to the ATTENDANCE file. Only the teacher
should be able to update the attendance data.
© 2023 National Institute of Tran 24
sport
Purpose of Database Systems
In the early days, database applications were
built directly on top of file systems, which leads
Data redundancy and inconsistency: data is stored in multiple file formats
to:
resulting induplication of information in different files
Difficulty in accessing data
Need to write a new program to carry out each new task
Data isolation
Multiple files and formats
Integrity problems
Integrity constraints (e.g., account balance > 0) become “buried” in
program code rather than being stated explicitly
Hard to add new constraints or change existing ones
© 2023 National Institute of Tran 25
sport
Purpose of Database Systems (Cont.)
Atomicity of updates
Failures may leave database in an inconsistent state with partial
updates carried out
Example: Transfer of funds from one account to another should
either complete or not happen at all
Concurrent access by multiple users
Concurrent access needed for performance
Uncontrolled concurrent accesses can lead to inconsistencies
Ex: Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
Security problems
Hard to provide user access to some, but not all, data
Database systems offer solutions to all the
above problems 26
© 2023 National Institute of Tran
sport
University Database Example
In this text we will be using a university database to illustrate all
the concepts
Data consists of information about:
Students
Instructors
Classes
Application program examples:
Add new students, instructors, and courses
Register students for courses, and generate class rosters
Assign grades to students, compute grade point averages (GPA)
and generate transcripts
© 2023 National Institute of Tran 27
sport
Database Management System
A database management system (DBMS) or database system in short, is
a software that can be used to create and manage databases.
DBMS lets users to create a database, store, manage, update/modify
and retrieve data from that database by users or application programs.
Some examples of open source and commercial DBMS include MySQL,
Oracle, PostgreSQL, SQL Server, Microsoft Access, MongoDB
A database system hides certain details about how data are actually
stored and maintained. Thus, it provides users with an abstract view of
the data. A database system has a set of programs through which users
or other programs can access, modify and retrieve the stored data.
© 2023 National Institute of Tran 28
sport
Characteristics of DBMS
It uses a digital repository established on a server to store and manage the
information.
It can provide a clear and logical view of the process that manipulates data.
DBMS contains automatic backup and recovery procedures.
It contains ACID properties which maintain data in a healthy state in case of
failure.
It can reduce the complex relationship between data.
It is used to support manipulation and processing of data.
It is used to provide security of data.
It can view the database from different viewpoints according to the
requirements of the user.
© 2023 National Institute of Tran 29
sport
Advantages of DBMS
Controls database redundancy: It can control data redundancy because it
stores all the data in one single database file and that recorded data is placed
in the database.
Data sharing: In DBMS, the authorized users of an organization can share the
data among multiple users.
Easily Maintenance: It can be easily maintainable due to the centralized
nature of the database system.
Reduce time: It reduces development time and maintenance need.
Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
multiple user interface: It provides different types of user interfaces like
graphical user interfaces, ©application program
2023 National Institute interfaces
of Tran 30
sport
Types of Databases
There are various types of databases used for storing different varieties
of data:
© 2023 National Institute of Tran 31
sport
1) Centralized Database
It is the type of database that stores data at a centralized database system. It
comforts the users to access the stored data from different locations through
several applications. These applications contain the authentication process to
let users access data securely. An example of a Centralized database can be
Central Library that carries a central database of each library in a
college/university.
Advantages of Centralized Database
It has decreased the risk of data management, i.e., manipulation of data will not
affect the core data.
Data consistency is maintained as it manages data in a central repository.
It provides better data quality, which enables organizations to establish data
standards.
It is less costly because fewer vendors are required to handle the data sets.
© 2023 National Institute of Tran 32
sport
2) Distributed Database
Unlike a centralized database
system, in distributed systems,
data is distributed among different
database systems of an
organization.
These database systems are
connected via communication
links. Such links help the end-
users to access the data easily.
Examples of the Distributed
database are Apache Cassandra,
HBase, Ignite, etc.
© 2023 National Institute of Tran 33
sport
3) Relational Database
This database is based on the relational data model, which stores data in the
form of rows(tuple) and columns(attributes), and together forms a
table(relation).
A relational database uses SQL for storing, manipulating, as well as
maintaining the data. E.F. Codd invented the database in 1970. Each table in
the database carries a key that makes the data unique from others. Examples
of Relational databases are MySQL, Microsoft SQL Server, Oracle, etc.
© 2023 National Institute of Tran 34
sport
4) NoSQL Database
Non-SQL/Not Only SQL is a type of database that is used for storing a wide range of
data sets. It is not a relational database as it stores data not only in tabular form but
in several different ways.
It came into existence when the demand for building modern applications increased.
Thus, NoSQL presented a wide variety of database technologies in response to the
demands. We can further divide a NoSQL database into the following four types:
© 2023 National Institute of Tran 35
sport
5) Cloud Database
A type of database where data is stored in a virtual
environment and executes over the cloud computing
platform. It provides users with various cloud computing
services (SaaS, PaaS, IaaS, etc.) for accessing the
database. There are numerous cloud platforms, but the
best options are:
© 2023 National Institute of Tran 36
sport