ADBMS Lec1
ADBMS Lec1
TOPIC: INTRODUCTION
BSCS13- ABCDE
Contents
• Introduction
• Metadata Analysis
2
Introduction
3
Data
5
Information
• Data that has been organized, processed, or
structured to provide context, meaning, and
relevance.
• Knowledge is the
actionable insight
or understanding
derived from
information. It
involves patterns,
relationships, or
interpretations
that help make
decisions.
Example: “If the temperature exceeds 40°C, outdoor activity should be avoided to prevent heatstroke.”
7
Information Management
Systems
An Information
Management
System (IMS)
refers to any
framework of
software that
facilitates the
collection, storage,
organization, and
distribution of
information.
8
Data-Information-
Knowledge
Data → Processed → Information → Analyzed → Knowledge
9
Data-Information-Knowledge
• Goal: Wisdom to take decision
10
Data-Information-Knowledge
11
OLTP vs OLAP
Aspect OLTP (Online Transaction Processing) OLAP (Online Analytical Processing)
Purpose Manages real-time transactions and day-to-day Performs data analysis and supports decision-making
operations. processes.
Data Type Current, operational data (e.g., recent transactions). Historical and aggregated data (e.g., trends over time).
Operations INSERT, UPDATE, DELETE, and simple SELECT queries. Complex SELECT queries with aggregation, grouping, and
filtering.
Query Complexity Simple and fast queries for transactional purposes. Complex queries for analytics and reporting.
Schema Design Highly normalized to reduce redundancy. Denormalized (e.g., star or snowflake schema) for faster
query performance.
Focus Speed, reliability, and accuracy for transactions. Insights, patterns, and trends for strategic decisions.
Users Operational staff, cashiers, or end-users. Managers, analysts, and executives.
Concurrency Supports high-concurrency environments (thousands of Low concurrency; a few users run analytical queries at a
users). time.
Database Size Smaller size (usually in GBs). Larger size (usually in GBs to TBs).
Examples of Use Banking systems, e-commerce checkout, ATM Sales trend analysis, market research, financial forecasting,
Cases transactions, inventory updates. KPIs reporting.
Examples of Tools MySQL, PostgreSQL, Oracle Database, Microsoft SQL Microsoft SSAS, Google BigQuery, Amazon Redshift,
Server. Snowflake.
Example Query SELECT * FROM orders WHERE order_id = 101; SELECT region, SUM(sales) FROM orders GROUP BY region;
12
OLTP vs OLAP
• OLTP Example:
• Scenario: A customer purchases a product from an e-commerce
store.
• Transaction:
INSERT INTO orders (order_id, customer_id, product_id, order_date, quantity,
total_price)
VALUES (101, 1, 45, '2025-01-01', 2, 100.00);
• This updates the orders table immediately to reflect the purchase.
• OLAP Example:
• Scenario: The store owner analyzes sales trends across regions.
• Analytical Query:
SELECT region, SUM(total_price) AS total_sales FROM orders GROUP
BY region ORDER BY total_sales DESC;
• This query aggregates historical data to identify the region with the
highest sales.
13
Data Selection
Using Structured Query Language SQL
14
Structured Query Language
15
Data Selection
Constraint on Data
Data Selection
Data Selection Representation
• Single Source • Single Row • Expression
• Multiple Data • Aliases
Sources Constraint • Reordering
• Multiple Row
Data
Constraint
16
Data Selection
17
Group By Example
SELECT region, SUM(sales) AS total_sales
FROM orders
GROUP BY region;
18
Having Example
SELECT region, SUM(sales) AS total_sales
FROM orders
GROUP BY region
HAVING SUM(sales) > 300;
19
Order By Example
SELECT region, SUM(sales) AS total_sales
FROM orders
GROUP BY region
ORDER BY total_sales DESC;
20
Metadata exploration
Metadata:
Data about data
21
Metadata exploration
• Show Databases
• Show Tables
• Describe Employees
22
SELECT
Clause
23
SELECT
Clause
24
SELECT
Clause
25
FROM
Clause
26
FROM
Clause
27
Data From Multiple Entities
28
29
Which Join Should You
Use?
• Use INNER JOIN when you only want the
matching data.
• Use LEFT JOIN when you want all records
from the left table.
• Use RIGHT JOIN when you want all records
from the right table.
• Use FULL JOIN when you need everything
from both tables.
• Use WHERE IS NULL to find unmatched
records.
30
Old-Style Join Using WHERE Clause
31
Cartesian Product
32
Natural Joins
33
Retrieving through Natural
Join
34
Join with Using Clause
35
Join with Using Clause
36
Join with ON Clause
37
Join with ON Clause
38
Join with ON Clause
39
Outer Join
40
Left Outer Join
41
Right Outer Join
42
Full Outer Join
43
Conclusion
• We discussed following topics
• Data-Information-Knowledge
• Structure Query Language
• Data selection
• Single source
• Multiple sources
44
45
Happy
Learning!