CTT102-Chapter 1-Overview PDF
CTT102-Chapter 1-Overview PDF
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
world domain to
digitize & support
automation?
Computers
3
Introducti
4.0
fit@hcmus
Introduction
⬜ How?
Data Database
Implementation
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
Introducti
4.0
fit@hcmus Introduction
Database Management System (DBMS)
A collection of programs that enables users to create
and maintain a database = software
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
⬜ 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
…
struct SINHVIEN
{
Program char[10] masv;
char[100] hoten;
};
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
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
Program Program
Catalog/metadata
Isolation Isolation
Catalog/metadata
Data Data
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
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
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
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
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
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
Transaction
Query Compiler DDL Compiler
Manager
Metadata,
Statistics
Query plan
Metadata
Execution Logging & Concurrency
Engine Recovery Control
Index, File &
Record Request
Buffer
Buffers
Manager
Read/Write Pages
Storage
Manager
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
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
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
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
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
59
Introduction
2DB - FIT -
4.0
fit@hcmus
60
Introduction
2DB - FIT -