DTS304 - Lecture 1
DTS304 - Lecture 1
Modern
DBMSs (1)
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;