0% found this document useful (0 votes)
10 views45 pages

DTS304 - Lecture 1

The document provides an introduction to database systems, highlighting their importance in managing data for organizations and overcoming limitations of traditional file systems. It discusses the role of Database Management Systems (DBMS) in facilitating data sharing, integration, and security, as well as the various types of modern DBMS and their features. Additionally, it covers the components of a database system, the purpose of database systems, and the functionalities of database languages and engines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views45 pages

DTS304 - Lecture 1

The document provides an introduction to database systems, highlighting their importance in managing data for organizations and overcoming limitations of traditional file systems. It discusses the role of Database Management Systems (DBMS) in facilitating data sharing, integration, and security, as well as the various types of modern DBMS and their features. Additionally, it covers the components of a database system, the purpose of database systems, and the functionalities of database languages and engines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

DTS304 – Database Management I

LECTURE 1 – Introduction to Database Systems

Dr. Stephen A. Adubi


[email protected]
Organizations use data to keep track of their
day-to-day operations.
 This data is used to generate information, which
Why in turn is the basis for good decisions.
Databases? Databases are involved in almost all facets and
activities of our daily lives, from school to work,
medical care, and government.

Databases evolved from the need to manage


large amounts of data in an organized and
efficient manner.
Note: This has ben replaced by modern DBMS.
In the early days of computing, when businesses
began to handle large amounts of data,
File System Data computer file systems emerged as a way to
Processing organize this information.
However, file system data management has
significant limitations, making the database
approach much more desirable.
Lengthy Development Times
 Even simple data retrieval tasks required
extensive programming.
Limitations of
Difficulty of Getting Quick Answers
File System Data
Processing (1)  The need to write programs made ad hoc queries
impossible, leading to delays in fulfilling
information requests.
Data Redundancy
 Independent files often contained the same data,
leading to wasted storage space and potential
inconsistencies.
Structural and Data Dependence
 Application programs were often tightly linked to
the specific structure and format of the data files.
Limitations of  Changes to file structures required modifications
File System Data to the programs accessing those files.
Processing (2) Data Anomalies
 Inconsistencies and errors could arise during data
updates, insertions, and deletions due to data
redundancy and lack of coordination across files.
Limited Data Sharing
 Data stored in separate files was difficult to share
among different applications and users, creating
"islands of information".
These were developed to address these inherent
weaknesses of file systems.
Database Instead of depositing data in independent files,
Management a DBMS presents the database to the end user
Systems as a single, integrated computer structure that
(DBMSs) stores a collection of end-user data and
metadata (data about data).
A DBMS is the collection of programs that
manages the database structure and controls
access to the data stored in the database.
DBMS – What The DBMS serves as an intermediary between
is it? the user and the database.
Data sharing
 The DBMS enables data in the database to be
shared among multiple applications or users.
 This reduces the potential problem of islands of
Advantages of
information.
DBMS (1)
Data integration
 The DBMS integrates the many different users’
views of the data into a single all-encompassing
data repository.
Reduced data redundancy
 By providing a centralized view of data, the
DBMS helps to minimize the storage of the same
data in multiple locations.
Improved data consistency
 Centralized data management through a DBMS
helps enforce consistency across the data.
Advantages of Data integrity
DBMS (2)  The DBMS enforces data integrity by
implementing rules and constraints to ensure the
accuracy and validity of the data.
Data security
 The DBMS provides mechanisms to control
access to the database, ensuring that only
authorized users can view or modify specific
data.
Data independence
 DBMSs provide data independence, separating
the logical view of data from its physical storage,
making it easier to make changes to the database
Advantages of without affecting applications.
DBMS (3) Efficient data retrieval and manipulation
 Databases are specialized structures that allow
computer-based systems to store, manage, and
retrieve data very quickly.
 The DBMS provides tools and query languages
like SQL to efficiently access and manipulate
data.
Improved decision support
Increased application development productivity
Relational DBMS (1)

Modern
DBMSs (1)

Google Cloud SQL

PostgreSQL
Relational DBMS (2)

Modern
DBMSs (2) Microsoft Azure
SQL Database
NoSQL DBMS

Modern
DBMSs (3) CouchDB

Amazon DocumentDB
Diverse Database Types
 Databases can be classified based on the
following:
• Number of users
Modern DBMS
• Data location (centralized vs. distributed)
– Features (1)
• Type of data
• Intended usage
• operational vs. analytical/data warehousing
• Degree of structure.
Client/Server Architecture
 Many modern database systems operate on a
client/server architecture, where processing
tasks are split among client applications and
database servers.
Web Integration
 DBMSs provide interfaces for web-based access
and integration with web technologies.
Modern DBMS Cloud-Based Services
– Features (2)  Cloud computing offers database-as-a-service
models, providing scalability and cost-efficiency.
Data Warehousing and Business Intelligence
 Specialized databases like data warehouses,
along with online analytical processing (OLAP)
tools, support decision-making and business
intelligence by storing and analyzing historical
data.
Performance Tuning and Query Optimization
 Modern DBMS include mechanisms for optimizing
query execution and tuning database performance
to ensure timely responses.
Modern DBMS Transaction Management and Concurrency Control
– Features (3)  DBMS manage database transactions and ensure
data integrity and consistency in multi-user
environments.
Distributed Database Management Systems
(DDBMS)
 For organizations with geographically dispersed
data, DDBMS govern the storage and processing of
logically related data across interconnected
computer systems.
The term database system refers to an
organization of components that define and
regulate the collection, storage, management,
Database and use of data within a database environment.
Systems The database system is composed of the five
major parts shown in the Figure (on the next
slide):
 Hardware
 Software (OS, DBMS, Application Programs, …)
 People (DBAs, End Users, Database designers, …)
 Procedures
 Data.
Components of a Database System
The purpose of database systems is
multifaceted, aiming to provide a structured,
efficient, and reliable way to manage data for
Purpose of various organizational needs.
Database
Database systems, facilitated by Database
Systems
Management Systems (DBMS), were developed
to overcome the limitations of earlier file-
processing systems.
1. Managing Large Volumes of Data
 Database systems are designed to manage large
bodies of information that are highly valuable and
Purpose of are often accessed by multiple users and
Database applications simultaneously.
Systems –  Corporate databases can range in size from
Cont’d (1) hundreds of gigabytes to terabytes, even petabytes.
2. Providing Data Abstraction
 A major purpose is to provide users with an abstract
view of the data, hiding the intricate details of how
the data are stored and maintained at the physical
level.
 This abstraction simplifies users' interactions with
the system.
3. Facilitating Data Sharing
 Database systems enable data to be shared
Purpose of among multiple applications or users.
Database  The DBMS integrates different users' views of the
Systems – data into a single, all-encompassing data
Cont’d (2) repository.
4. Supporting Decision Making
 Databases serve as the central repository for
critical data used by business applications.
 They transform raw data into information that is
essential for managerial decision making at all
levels within an organization.
5. Enforcing Standards
 The introduction of a database system allows for
Purpose of the enforcement of strict procedures and
Database standards for data management, ensuring a
Systems – more controlled and organized approach
Cont’d (3) compared to file systems.
Database Languages are specialized languages
designed for interacting with and managing
databases.
Database These languages serve various purposes,
Languages including defining the structure of the database,
manipulating the data within it, and querying it
to retrieve information
Data-Definition Language (DDL) is the type of
language is used to specify the database schema,
which includes defining the relations (tables),
Database their attributes (columns), and constraints.
Languages -
SQL includes DDL commands for creating,
DDL
deleting, and modifying database objects such as
tables, indexes, and views.
Examples of SQL DDL commands include CREATE
SCHEMA, CREATE TABLE, NOT NULL, UNIQUE,
PRIMARY KEY, and FOREIGN KEY.
An example for creating a table named
orderdetails
CREATE TABLE orderdetails
(
DDL - Example orderid varchar(255) NOT NULL,
mealid integer NOT NULL,
quantity numeric(4,2) NOT NULL,
PRIMARY KEY (orderid, mealid),
FOREIGN KEY (mealid) REFERENCES
meals (mealid),
FOREIGN KEY (orderid) REFERENCES
orders (orderid)
)
Data-Manipulation Language (DML) enables
users to access or manipulate the data stored in
the database.
Database
This includes commands for inserting new data,
Languages -
deleting existing data, updating data, and
DML
retrieving data through queries.
SQL is a widely used DML, with commands such
as SELECT, INSERT, UPDATE, and DELETE.
DML can be either procedural or declarative.
SQL is largely considered a nonprocedural query
language.
An example for retrieving data from the meals
relation.
SELECT * FROM meals WHERE name LIKE
'%Chicken%' OR name LIKE '%chicken%';
DML - Example
An example for retrieving data from two
relations.
SELECT name FROM meals WHERE mealid =
(
SELECT mealid FROM orderdetails
GROUP BY mealid
ORDER BY COUNT(mealid) DESC LIMIT 1
);
SQL also does not support actions such as input
from users, output to displays, or
communication over the network.
Database
Such computations and actions must be written
Languages -
in a host language, such as C/C++, Java, or
APIs
Python, with embedded SQL queries that access
the data in the database.
Application programs are programs that are
used to interact with the database in this
fashion.
Examples in a university system are programs
that allow students to:
 register for courses,
Database  generate class rosters,
Languages –  calculate student GPA,
APIs (Cont’d)  generate payroll checks and perform other tasks.
To access the database, DML statements need to
be sent from the host to the database where
they will be executed.
 This is most commonly done by using an
application-program interface (APIs, set of
procedures) that can be used to send DML and
DDL statements to the database and retrieve the
results.
Java code to process data…
Class.forName("com.mysql.jdbc.Driver");
String fname = txtFirstName.getText();
String lname = txtLastName.getText();
DB Access - String matric = txtMatric.getText().toUpperCase();
MySQL and int test1 = Integer.parseInt(txtTest1.getText());
int test2 = Integer.parseInt(txtTest2.getText());
Java:
String report;
Example (1) int sum = test1 + test2;

if(sum >= 0 && sum <= 11)


report = "Work hard";
else if(sum >= 12 && sum <= 15)
report = "Need to improve";
else if(sum >= 16 && sum <= 19)
report = "Not bad";
else
report = "On a good course";
Java code to process data + Embedded SQL…
//connect to the database and post data
String dburl =
"jdbc:mysql://localhost:3306/student_info";
DB Access - //connection string
MySQL and Connection con =
DriverManager.getConnection(dburl, "root", "");
Java : String sql = "insert into info values (?, ?, ?,
Example (2) ?, ?, ?)";
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, matric);
ps.setString(2, fname);
ps.setString(3, lname);
ps.setInt(4, test1);
ps.setInt(5, test2);
ps.setString(6, report);
Java code to display status…
if(ps.executeUpdate() > 0)
DB Access - JOptionPane.showMessageDialog(null,
MySQL and "Successful DB Posting");
Java : else
Example (3)
JOptionPane.showMessageDialog(null,
"Unsuccessful DB Posting, no new
rows were added");
con.close();
The Database Engine is a fundamental and
crucial component of a database system (DBMS),
responsible for managing and processing the
Database database.
Engine It can be broadly divided into several key
modules that work together to ensure efficient
data storage, retrieval, and manipulation.
A database system is partitioned into modules
that deal with each of the responsibilities of the
overall system.
Database The functional components of a database system
Engine (Cont’d) can be divided into
 The storage manager,
 The query processor component,
 The transaction management component.
A program module that provides the interface
between the low-level data stored in the database
and the application programs and queries
submitted to the system.
Storage The storage manager is responsible to the following
Manager tasks:
 Interaction with the OS file manager
 Efficient storing, retrieving and updating of data
The storage manager components include:
 Authorization and integrity manager
 Transaction manager
 File manager
 Buffer manager
The storage manager implements several data
structures as part of the physical system
implementation:
Storage  Data files -- store the database itself
Manager
 Data dictionary -- stores metadata about the
(Cont.)
structure of the database, in particular the
schema of the database.
 Indices -- can provide fast access to data items.
A database index provides pointers to those data
items that hold a particular value.
The query processor components include:
 DDL interpreter -- interprets DDL statements
and records the definitions in the data dictionary.
Query  DML compiler -- translates DML statements in a
Processor query language into an evaluation plan consisting
of low-level instructions that the query
evaluation engine understands.
• The DML compiler performs query optimization;
that is, it picks the lowest cost evaluation plan
from among the various alternatives.
 Query evaluation engine -- executes low-level
instructions generated by the DML compiler.
1. Parsing and translation
2. Optimization
3. Evaluation
Query
Processing
A transaction is a collection of operations that
performs a single logical function in a database
application.
Transaction
Management
(ACID) Transaction-management component ensures
that the database remains in a consistent
(correct) state despite system failures, e.g.
 power failures
 operating system crashes
 transaction failures.
Centralized databases
 One to a few cores, shared memory
Client-server
Database  One server machine executes work on behalf of
Architecture multiple client machines.
Parallel databases
 Many core shared memory
 Shared disk
 Shared nothing
Distributed databases
 Geographical distribution
 Schema/data heterogeneity
Database Architecture (Centralized/Shared-Memory)
Database Users
Schema definition
Storage structure and access-method definition
Schema and physical-organization modification
Database Granting of authorization for data access
Administrator
Routine maintenance
Periodically backing up the database
Ensuring that enough free disk space is available
for normal operations, and upgrading disk space
as required
Monitoring jobs running on the database
Coronel, C., & Morris, S. (2019). Database
systems: design, implementation and
management. 13th ed. Cengage learning.
Resources(s)
Hoffer, J. A., Ramesh, V., & Topi, H. (2016).
for Further
Modern database management. 11th ed.
Reading
Pearson.
Silberschatz, A., Korth, H. F., & Sudarshan, S.
(2020). Database system concepts, 7th ed.,
McGraw-Hill Education.

You might also like