0% found this document useful (0 votes)
54 views25 pages

DBMS Introduction: COMP3311 Database Management Systems

This document provides an introduction to database management systems (DBMS). It defines what a DBMS is and discusses how it differs from a traditional file system in organizing, accessing, and protecting stored data. The document also covers important DBMS concepts like data models, schemas that define different levels of abstraction, data independence, and languages for defining and manipulating data.

Uploaded by

Elizabeth Chan
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)
54 views25 pages

DBMS Introduction: COMP3311 Database Management Systems

This document provides an introduction to database management systems (DBMS). It defines what a DBMS is and discusses how it differs from a traditional file system in organizing, accessing, and protecting stored data. The document also covers important DBMS concepts like data models, schemas that define different levels of abstraction, data independence, and languages for defining and manipulating data.

Uploaded by

Elizabeth Chan
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/ 25

+

COMP3311 Database Management Systems


Spring 2022

DBMS Introduction
Prof Xiaofang Zhou
+ What is a DBMS? 2

User 1 User 2 … User n

Stored data

How to organize, access, share, protect, … stored data?


+ Data and Databases 3

• Data are facts such as age, salary, name, address,


etc.
• A database has the following properties.
– It usually represents some aspect of the real world
– The data have some inherent meaning
– It is designed, built and populated with data for a specific
purpose
• sales, human resources, manufacturing, banking, real estate, stock trading,
inventory management, …

• Databases touch all aspects of our lives!

A database is a collection of related data


+ DBMS 4

n A databasemanagement system (DBMS) is a


general-purpose software package that manages
databases
n A DBMS provides support/facilities for:
n Defining types, structures, constraints on data
n Storing data on some storage device
n Manipulating data (querying, updating)
n Sharing data among many users
n Protecting data from loss, corruption, unauthorized access

n A DBMS provides an environment for managing data


that is both convenient and efficient to use
+ Popular DBMS Products 5

n Oracle

n IBM DB2
n Microsoft SQL Server
n MySQL (MariaDB)

n PostgreSQL

n Microsoft Access

n dBASE

n SQLite…
+ DBMS vs File Systems 6

In file processing, applications access stored data using the


facilities provided by an operating system file system.

Marketing Sales … Accounting Drawbacks


– Data redundancy &
inconsistency
– Difficulty in accessing
OS file
system data
– Data isolation
– Integrity problems
Marketing Sales … Accounting – Atomicity of updates
data data data
– Concurrent access
– Security problems
+ DBMS vs File Systems 7

In database processing, applications access stored data using


the facilities provided by a DBMS

Marketing Sales … Accounting Major Principles


– integrates an
organization’s data.
DBMS – separates meta-data
(description of data) and
data.

The system The


– supports multiple views
catalog System
Database = database of data.
contains the Marketing + Sales + contains the
Catalog – controls definition and
meta-data. … + Accounting data data.
access of data centrally.

A DBMS provides automated solutions for the data management


problems encountered when using file systems
+ Data Independence 8

n Onebig problem in application development is the


separation of applications from data

n Do I have to change my program when I …


n replace my hard drive?
n store the data in a B-tree instead of a hash file?
n partition the data into two physical files (or merge two
physical files into one)?
n store salary as floating point number instead of integer?
n develop other applications that use the same set of data?
n add more data fields to support other applications?

n Solution: introduce levels of abstraction


A DBMS provides separation of applications and data via
several levels of abstraction.
+ Three Levels of Abstraction 9

ARR CSE Finance Office


view 1 view 2 ..……... view n

Logical
HKUST database
view

Physical
Files on disks/cloud
view
+ Three Levels of Abstraction 10

n Physical level: describe how a record is stored on disks


n e.g., “Divide the customer records into 3 partitions and store them on
disks 1, 2 and 3.”

n Logical level: describe how data are structured in database,


and the relationships among the data
n Similar to defining a record type or class in a programming language:
class customer {
string name;
string street;
int city;
};

n View level: Define a subset of the database for a particular


application. Views can hide information (e.g. salary) for security
purposes or add information (e.g., age).
+ Instances and Schemas 11

n Each level is defined by a schema, which describes


the data at the corresponding level
n A logical schema defines the logical structure of the database
(e.g., set of customers and accounts and the relationship
between them)
n A physical schema defines the file formats and locations

n A databaseinstance refers to the actual content of


the database at a particular point in time.
n A database instance must conform to the corresponding
schema
+ Data Independence 12

Data independence is the ability to


Application modify a schema definition in one level
of abstraction without affecting a
schema definition in a higher level.

(described by)
View View (subschema)

Logical data independence


(shields users from changes in the logical structure)

(described by)
Logical view Logical schema

Physical data independence


(shields users from changes in the physical structure)
(described by)
Physical view Physical schema
+ An Example of Data Independence 13

Data on disk 1129 John Law ……

Program accessing data directly has to know:


program
• first 4 bytes is an ID number
• next 10 bytes is an employee name

Schema
Data on disk 1129 John Law …… Student:
ID: integer
Name: char(10)
DBMS

program
+ Data Models 14

n A collection of tools for describing:


n Data
n Relationships among data
n Data semantics
n Constraints on data
+ Entity-Relationship Model 15

n Example of entity-relationship model

social-security street
account-number balance

city
name

CUSTOMER DEPOSITOR ACCOUNT


+ Relational Model 16

Example of tabular data in the relational model:


name social-security street city account-number

Johnson 192-83-7465 Alma Palo Alto A-101


Smith 019-28-3746 North Rye A-215
Johnson 192-83-7465 Alma Palo Alto A-201
Jones 321-12-3123 Main Harrison A-217
Smith 019-28-3746 North Rye A-201

account-number balance
A-101 500
A-201 900
A-215 700
A-217 750
+ Data Definition Language (DDL) 17

n Notation for defining the database schema


n Express how data are organized in a formal language
n Examples:

CREATE TABLE customer (


customer-name varchar(40),
social-security char(11),
customer-street varchar(100),
customer-city varchar(20),
account-number varchar(10));

CREATE TABLE account (


account-number char(10),
balance integer);
+ Data Manipulation Language (DML) 18

n Language for accessing and manipulating the data


organized by the data model

n Two types of theoretical DML


n Algebra (Procedural) - user specifies what data is required
and how to get those data.
n Calculus (Nonprocedural) - user specifies what data is
required without specifying how to get those data

n DML in practice
n SQL
+ SQL 19

n Most
common language – used in all commercial
DBMSs

n Including DML, DDL and more


n Example
SELECT account-number
FROM account
WHERE balance <= 0
+ Transaction Management 20

n A transaction is a collection of operations that


performs a single logical function in the database
n Example: ATM withdrawal
Read account record
Modify balance
Write back modified record

n The transaction management (TM) component


ensures that the database remains in a consistent
(correct) state despite system failures (e.g., power
failures and operating system crashes) and
transaction failures
+ Concurrency Control 21

n Concurrency control (CC) manager controls the


interaction among the concurrent transactions, to
ensure the consistency of the database

Transaction 1

Transaction 2

Conflicting read/write
+ Storage/Buffer Management 22

n The storage manager provides an interface to the


buffer manager in the DBMS to access the data
stored on disk
n The buffer manager is responsible for fetching data
from the storage manager into main memory (the
buffer) and deciding what data to keep in the buffer
+ Overall System Architecture 23

naïve users application sophisticated database


(tellers, web users) programmers users (analysts) administrators
use write use use
application application query tools administration
interfaces programs tools

compiler DML queries DDL interpreter


and linker
application
program DML compiler and organizer
object code
query evaluation engine
query processor

buffer manager file manager authorization and transaction


integrity manager manager

storage manager

indices system catalog


(data dictionary) disk storage
data
statistical data
+ Database Users 24

n End Users
n Naïve users
n Invoke existing application programs (e.g., print monthly sales report).
n Interact with applications through a graphical user interface (GUI).
n Application programmers
n Develop applications that interact with DBMS through DML calls.
n Sophisticated users
n Issue queries either directly using a database query language (e.g.,
SQL) or via tools such as data analysis software.

n Database Administrator (DBA)


n Coordinates all activities of the database system.
n Defines and maintains the schemas.
n Defines and maintains the physical organization.
n Monitors and optimizes the database performance.
n Monitors access and grants access rights

A DBA must have a good understanding of an enterprise’s information


resources and needs
+ Summary 25

n Database management systems (DBMSs) address the


limitations of file systems for managing an enterprise’s data

n Data independence is fundamental to understanding a


database at different abstraction levels

n Data models are the foundation for developing a database


n The entity-relationship (E-R) model and relational model are commonly
used in practice

n Database languages (DDL and DML) are an integral part of a


DBMS
n SQL is the common database language for relational DBMSs

n A DBMS provides many facilities to efficiently manage the data


management and access needs of various users
n Query processing, storage management, transaction management

You might also like