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

CTT102-Chapter 1-Overview PDF

This document provides an overview of databases and database management systems (DBMS). It discusses how databases are used to store business and application data, and defines key database concepts like data, database, and DBMS. A DBMS is a collection of programs that enables users to create, operate, and maintain databases for tasks like defining data structures, storing data, querying data, and allowing shared access. Examples show how databases can be used to manage information for courses, projects, and employees in a company.

Uploaded by

sjkj klsjdf
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 views59 pages

CTT102-Chapter 1-Overview PDF

This document provides an overview of databases and database management systems (DBMS). It discusses how databases are used to store business and application data, and defines key database concepts like data, database, and DBMS. A DBMS is a collection of programs that enables users to create, operate, and maintain databases for tasks like defining data structures, storing data, querying data, and allowing shared access. Examples show how databases can be used to manage information for courses, projects, and employees in a company.

Uploaded by

sjkj klsjdf
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/ 59

Chapter 1

Overview of Database

4.0
fit@hcmus
4.0
fit@hcmus
Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus
Introduction
Marketing, production, banking,
Real business & education, entertainment, medical, … 
application complex, richness

Automate & support tasks


How can computers
understand the real
develop

world domain to
digitize & support
automation?

Computers
3

Introducti
4.0
fit@hcmus
Introduction
⬜ How?

Data Database
Implementation

Analyze & design

Processes, business
rules, interface

Application

Introducti
4.0
fit@hcmus
Introduction
 Examples of information
 Banking and finance
 Customer information, accounts, loans, banking
transactions
 Customer information: name, address, email, identity
number, …
 Information of sales and purchases
 Education
 Student information, course registrations and grades
 Airline
 Reservations and information of flights and ticket prices
 Human resources
 Information about employees, salaries, payroll taxes
4.0
fit@hcmus Introduction
 What is data ?
 Facts that can be recorded and have meaning
 Pieces of data are individual pieces of information
 Data is a collection of facts, such as numbers, words,
measurements, observations or even just descriptions of things
represented in a form suitable for processing by computer
 Example
 “Nguyễn Văn A” is a student’s name
 “11.12.008 ” is a student’s ID
 “19-02-2015” is a Tet day of 2015

6
4.0
fit@hcmus Introduction

 Database (DB)
 A collection of related data
 Contains information relevant to a business

 Example:
 Sale, purchase
 Payable and receivable accounts
 Employees
 Printing of employee’s weekly paychecks

7
4.0
fit@hcmus Introduction
 Database (DB)
 Definition:
 A logically coherent collection of data with some inherent
meaning
 Random assortment of data cannot correctly be a database
 Is designed, built, and populated with data for a specific
purpose, for intended group of users or applications
 Example:
 A list of students  data structure of group of students
 List of classes  data structure of classes
 Data is stored using a structure  structured database
 Other types of database: unstructured databases,
document databases, graph database
8
4.0
fit@hcmus
Example 1 – Course Management
4.0
fit@hcmus
4.0 Example 2 – PROJECT MANAGEMENT
EMPLOYEE LName MName FName SSN BirthDate SuperSSN DNo
Tran Hong Quang 987987987 03/09/1969 987654321 4
Nguyen Thanh Tung 333445555 12/08/1955 888665555 5
Nguyen Manh Hung 666884444 09/15/1962 333445555 5
Tran Thanh Tam 453453453 07/31/1972 333445555 5

PROJECT PName PNumber PLocation DNum

San pham X 1 VUNG TAU 5


San pham Y 2 NHA TRANG 5
San pham Z 3 TP HCM 5
Tin hoc hoa 10 HA NOI 4

WORKS_ON SSN PNo Hours


123456789 1 32.5
123456789 2 7.5
666884444 3 40.0
453453453 1 20.0
4.0
fit@hcmus
Example 2 – Project management
NHANVIEN HONV TENLOT TENNV MANV NGSINH MA_NQL PHG
Tran Hong Quang 987987987 03/09/1969 987654321 4
Nguyen Thanh Tung 333445555 12/08/1955 888665555 5
Nguyen Manh Hung 666884444 09/15/1962 333445555 5
Tran Thanh Tam 453453453 07/31/1972 333445555 5

DEAN TENDA MADA DDIEM_DA PHONG


San pham X 1 VUNG TAU 5
San pham Y 2 NHA TRANG 5
San pham Z 3 TP HCM 5
Tin hoc hoa 10 HA NOI 4

PHANCONG MA_NVIEN SODA THOIGIAN


123456789 1 32.5
123456789 2 7.5
666884444 3 40.0
453453453 1 20.0
11

Introducti
4.0
fit@hcmus Introduction
 Database Management System (DBMS)
 A collection of programs that enables users to create
and maintain a database = software

 A general-purpose software system that facilitates


 Definition – specifying the data types, structures, and
constraints for the data
 Construction – storing the data itself on some storage
medium
 Manipulation – querying the database to retrieve data,
updating the database to reflect changes, generating
reports from the data
 Sharing – allowing multiple users/programs to access the
database concurrently
12
4.0
fit@hcmus Introduction
 Database Management System (DBMS)
Users/Programmers
Set of programs
that enable users to Applications/Queries

create, operate,
DBMS
and maintain Query/Program
databases Processing

Data Accessing

Catalog Database
Database
Definition
DB system

13
4.0
fit@hcmus Example
 Company database - project management
 Definition
 Specify the structure of records, including data elements,
data types
 Construction
 Store data to represent an employee, project,
department… as a record
 Manipulation
 Querying: “Select the employees whose department is 5”
 Updating: “Move the employee Nguyen Thanh Tung to
department 1”
4.0
fit@hcmus
Quiz #1

⬜ What are the purpose of DB?

⬜ DBMS is?
A. A data set with the same structure
B. Discrete data
C. Tools supporting data or application programming
D. A set of programs to help create, operate, and
maintain databases

15

Introducti
4.0
fit@hcmus Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Evolution

 File

Application 1

File

Application 2 File
System File

Application 3
File Data

Application declare data structure inside

An application program has its own data


4.0
fit@hcmus
Evolution - Example


struct SINHVIEN
{
Program char[10] masv;
char[100] hoten;
};

<12345, Nguyen Van X>


<54321, Tran Van Y>
<21345, Vo Van Z>

Data file

18

Introducti
4.0
fit@hcmus Evolution
 Limitations
 Data redundancy
 Wasted storage space
 Opportunities of the inconsistency
 Data sharing is limited
 Difficult recovery
 Low security

 But, still be used in some applications


 Small size
 Storing and accessing data only, not including other
processing operations
 Fee costs less
 Operation or maintenance
4.0
fit@hcmus Evolution

 Database

Application 1

Application 2 DBMS
Database

Application 3
4.0
fit@hcmus
Content
 Introduction
 The evolution of database systems
 Characteristics of the database approach
- Self-describing
- Insulation between programs and data
- Data abstraction
- Views of data
- Sharing of data
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Self-Describing
 The DB system contains not only the DB itself, but
also a complete definition/description of the DB
structure
 The definitions are stored in catalog called
“metadata”
 Contains information such as the structure of data, type
and storage format of data items, and constraints on the
data
 Many applications can access to the DB
 Refer to catalog, knowing the structure of files in specific
DB (type and format of data)
4.0
fit@hcmus
Self-Describing
 An example of a database catalog/metadata
RELATION

Relation_name No_of_columns
EMPLOYEE 7
PROJECT 4
WORKS_ON 3

COLUMN

Column_name Data_type Belongs_to_relation


LName Character(10) EMPLOYEE
FName Character(10) EMPLOYEE
… … …
4.0
fit@hcmus Isolation
 The structure of data is stored in catalog
separately from the access programs
 Program-Data independence

Program Program
Catalog/metadata
Isolation Isolation
Catalog/metadata
Data Data

Program contains catalog  data DBMS contains catalog  data is


structure depends on program independent of program

 A little change in the structure happens


 Application programs are rarely revised
4.0
fit@hcmus Data abstraction
 The DB system provides a conceptual
representation of the data to hide certain
details of how the data are stored and
maintained

 Example
 Data model is a type of data abstraction
 Objects
 Properties
 Relationships
 These logical concepts are easier for user to
understand than computer storage concepts
4.0
fit@hcmus Views of data
 A DB has many users
 Each user may require a different perspective or view of
the database
 A view may be
 A subset of the database
 Aggregate data that are derived from the database

Different views SV-CHINHQUI SV-HOANCHINH

SINHVIEN
Data
4.0
fit@hcmus Sharing of data
 A multiuser DBMS
 Allows multiple users to access the DB at the
same time
 Data for many applications are integrated and
maintained in a single DB

 Using concurrency control mechanisms to


access the data reasonably
 Avoid data contention (tranh chấp)
 Ensure the data will always be valid when they are
accessed
4.0
fit@hcmus Content
 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users: Actors on the scene
- Database administrator (DBA)
- Database designer
- End user
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Database administrator
 Many people use the same resources
 Need a chief administrator to oversee and
manage

 Responsibility
 Administering the DB
 Authorizing access to the DB
 Coordinating and monitoring the use of DB
 Acquiring software and hardware resources
as needed
4.0
fit@hcmus Database designer
 Responsibility
 Identifying the data to be stored in the DB
 Choosing appropriate structures to represent and
store the DB
 Communicating with all DB users to understand their
requirements, to come up with a design that meet
the requirements

 Can be
 Staff of the DBA
 Other staffs taking responsibilities after the DB
designed is completed
4.0
fit@hcmus End user

 People whose jobs require to access to


the DB
 Querying, updating, generating reports

 Categories
 Casual end user
 Naïve or parametric end user
 Sophisticated end user
4.0
fit@hcmus End user
 People whose jobs require to access to the DB
 Querying, updating, generating reports

 Categories
 Casual end user
 Occasionally access the DB
 Need different information each time
 Use sophisticated DB query language to specify requests
 Middle or high level manager
 Naïve or parametric end user
 Sophisticated end user
4.0
fit@hcmus End user

 People whose jobs require to access to the DB


 Querying, updating, generating reports

 Categories
 Casual end user
 Naïve or parametric end user
 Constantly query and update the DB
 Use standard types of queries and updates that have been
programmed and tested
 Employee
 Sophisticated end user
4.0
fit@hcmus End user
 People whose jobs require to access to the DB
 Querying, updating, generating reports

 Categories
 Casual end user
 Naïve or parametric end user
 Sophisticated end user
 Be familiar with the facilities of the DBMS
 Implement the applications to meet the complex
requirements
 Engineers, scientists, business analysts
4.0
fit@hcmus Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Architecture
 Three-schema architecture:
External level

The part of the DB that


End user 1 End user n a particular user group
is interested in
External view 1 … External view n
Conceptual level (External/Conceptua
l
Mapping) The structure of the
Conceptual schema whole DB for a
community of users
(Conceptual/Int
Internal level ernal Mapping)
Internal schema
Physical storage
structure of the
DB
36

Introduction
2DB - FIT -
4.0
fit@hcmus Architecture
 Data independence
 Logic data independence
 The capacity to change the conceptual schema without
change to external schemas or application programs
 Example
 Adding/removing a record type or data item (expand/reduce DB)
 Changing constrains

 Physical data independence


 The capacity to change the internal schema without change to
the conceptual schema
 Example
 Physical files had to be reorganized to improve the performance
of retrieval or update
38
4.0
fit@hcmus Architecture
User/Application Database Administrator
Transaction Commands
Queries, Updates DDL Commands

Transaction
Query Compiler DDL Compiler
Manager
Metadata,
Statistics
Query plan
Metadata
Execution Logging & Concurrency
Engine Recovery Control
Index, File &
Record Request

Index/File/ Log Pages


Record Manager Lock Table
Data,
Metadata,
Page Commands Indexes

Buffer
Buffers
Manager

Read/Write Pages

Storage
Manager

Storage Source: Database System: The Complete Book. 39

Introduction
2DB - FIT -
4.0
fit@hcmus Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Properties of DBMS
 Controlling redundancy
 By placing all the data together, we do not have to search
multiple files to collect this data
 Data sharing
 In multiple user environment, concurrency data access is
allowed
 Restricting unauthorized access
 Users or user groups are given account numbers protected by
passwords to gain access to the DB
 Providing multiple user interfaces
 Provide query languages for casual users, programming
language interfaces for programmers, forms and command
codes for parametric users
41

Introduction
2DB - FIT -
4.0
fit@hcmus Properties of DBMS
 Enforcing integrity constraints
 Integrity constraints
 Rules/conditions are derived from the meaning/semantics of the
data or the miniworld it represents
 Some constraints
 Can be specified to the DBMS and automatically enforced
 May have to be checked by update programs

 Providing backup and recovery


 Provide facilities for recovering from hardware and
software failures
 Make sure the DB is restored to the state it was before
4.0
fit@hcmus Properties of DBMS

 Others
 Potential for enforcing standards
 Permit DBA to define and enforce standards among
database users in a large organization
 Flexibility
 It may be necessary to change the structure of a DB as
requirements change without affecting the stored data and
the existing application programs
 Reduced application development time
 Availability of up-to-date information
 As soon as one user’s update is applied to the DB, all other
users can immediately see this update
4.0
fit@hcmus Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus
Data models

Data model

Is described by

Specific
domain Database schema

Is described by

Database instance

45

Introducti
4.0
fit@hcmus Data models

 Definition
 A collection of concepts that can be used to
describe the structure of a DB
 Data types, relationships, and constraints
 Including a set of basic operations for specifying
retrievals and updates on the DB

 Categories
 High level or conceptual data models
 Representational or implementation data models
 Low level or physical data models
4.0
fit@hcmus Data models
 High level data model
 Provide concepts that are close to the way users
perceive data
 Eg: entity relationship model, object-oriented model…
 Implementation data model
 Provide concepts that may be understood by end users,
but that are not too far from the way data is organized
within the computer
 Eg: relational model, network and hierarchical models…
 Low level data model
 Provide concepts the describe the details of how data is
stored in the computer
4.0
fit@hcmus
Example of data model

⬜ Entity Relationship Diagram


� Concepts
Entity type Atrribute
Relationship

⬜ Network data model


� Concepts
Record type
Relationship 1:N

48

Introducti
4.0
Database schema - Example of
fit@hcmus ER Model

Mark ID Term
Year Instructor
(0,n) (1,1)
Study Course Open
pre
ID (1,n)
ID (0,n)
Name Name
Grade Student Faculty Subject
Major NoOfCredits (0,n)

constraint
(0,n)

post
4.0
fit@hcmus
Database schema

⬜ Definition
� Description of the structure and constraints on the database
about a particular domain (banking, education, marketing, etc.)
� Example:

50

Introducti
4.0
Database schema - Example of Object-
fit@hcmus Oriented Model

Student
Name Course
Grade study
Name
Major
1..* 0..* Number
planSchedule()
printReoord() 1

Mark
LabMark open
LectureMarrk
ProjectMark
0..*
UpdateMark()
Subject
Name
+pre
Faculty
NoOfCredits 0..*
UpdateCredit()
0..* Constraint
+post
4.0
Database schema - Example of
fit@hcmus relational model

Student Study Course


StuID StuID CouID
Name CouID Number
Grade LabMark SubID
Major LectureMar
k

Subject
Constraint
SubID
SubID
Name
PreviousID
Faculty
NoOFCredits
4.0
Database schema - Example of
fit@hcmus network data model

Student Subject

PreSubject

Subject_Open

PostSubject
Student_Mark
Course Constraint

Result_Course

Result
Database schema - Example of hierarchical
data model

Result
Level 1: LabMark LectureMark

Course Student
Level 2: Name Grade Major
Name Number

Subject
Level 3:
Name Faculty NoOfCredits
4.0
fit@hcmus
Database instance or status

⬜ Definition
� The data stored in database at a particular moment
of time is called instance of database.

55

Introducti
4.0
fit@hcmus Content

 Introduction
 The evolution of database systems
 Characteristics of the database approach
 Database users
 Architecture of a DBMS
 Properties of DBMS
 Data models
 Database languages
4.0
fit@hcmus Database language

 DDL – Data Definition Language


 Identify descriptions of the schema constructs
 Store the schema description in the DBMS catalog

 SDL – Storage Definition Language


 Specify the internal schema and the mappings
between two schemas

 VDL – View Definition Language


 Specify user views and their mapping to the
conceptual schema
4.0
fit@hcmus Database language
 DML – Data Manipulation Language
 Provide a set of operations including retrieval,
insertion, deletion and modification of the data

 Two types
 High level (nonprocedural)
 Entered interactively from a display monitor/terminal, or
 Embedded in a general-purpose programming language
 Low level (procedural)
 Must be embedded in a general-purpose programming
language

A query in a high-level DML often specifies which data to retrieve rather than how to retrieve it; therefore, such languages
4.0
fit@hcmus Discussion

 When will we use or not use the DB


approach?

59

Introduction
2DB - FIT -
4.0
fit@hcmus

60

Introduction
2DB - FIT -

You might also like