Database Management Chapter 01 - Introduction
Database Management Chapter 01 - Introduction
2
Introduction
• A database-management system (DBMS) is a collection of
interrelated data and a set of programs to access those data.
• If data are to be shared among several users, the system must avoid
possible anomalous results.
4
1.1 Database-System Applications
• Database systems are used to manage collections of data that:
5
1.1 Database-System Applications
• Here are some representative applications:
• Enterprise Information
• Sales: For customer, product, and purchase information.
7
1.1 Database-System Applications
• Web-based services
9
1.2 Purpose of Database Systems
• To allow users to manipulate the information, the system has a
number of application programs that manipulate the files, including
programs to:
• Add new students, instructors, and courses.
• Register students for courses and generate class rosters.
• Assign grades to students, compute grade point averages (GPA),
and generate transcripts.
10
1.2 Purpose of Database Systems
• New application programs are added to the system as the need arises.
12
1.2 Purpose of Database Systems
• Data redundancy and inconsistency: The same information may be
duplicated in several places (files). The various copies of the same
data may no longer agree.
• Data isolation: Because data are scattered in various files, and files
may be in different formats, writing new application programs to
retrieve the appropriate data is difficult.
13
1.2 Purpose of Database Systems
• Integrity problems: The data values stored in the database must
satisfy certain types of consistency constraints.
• That is, the system hides certain details of how the data are stored
and maintained.
15
1.3.1 Data Models
• The data models can be classified into four different categories:
• Relational Model
• Entity-Relationship Model
16
1.3.1 Data Models
• Relational Model
• Each table has multiple columns, and each column has a unique
name.
• Tables are also known as relations.
17
1.3.1 Data Models
• Entity-Relationship Model
18
1.3.1 Data Models
• Semi-structured Data Model
• JSON and Extensible Markup Language (XML) are widely used semi-
structured data representations.
19
1.3.1 Data Models
• Object-Based Data Model
20
1.3.2 Relational Data Models
• In the relational model, data are represented in the form of tables.
• Each table has multiple columns, and each column has a unique name.
21
1.3.2 Relational Data Models
22
1.3.3 Database Abstraction
23
1.3.3 Database Abstraction
• Since many database-system users are not computer trained,
developers hide the complexity from users through several levels of
data abstraction, to simplify users’ interactions with the system:
• Physical level:
• The lowest level of abstraction describes how the data are
actually stored.
24
1.3.3 Database Abstraction
• Logical level:
26
1.3.4 Instances and Schemas
• The collection of information stored in the database at a particular
moment is called an instance of the database.
27
1.4 Database Languages
• A database system provides a data-definition language (DDL) to
specify the database schema and a data-manipulation language
(DML) to express database queries and updates.
28
1.4.1 Data-Definition Language
• Thus, database systems implement only those integrity constraints
that can be tested with minimal overhead:
30
1.4.1 Data-Definition Language
• Authorization: We may want to differentiate among the users as far
as the type of access they are permitted on various data values in the
database.
• Read authorization: which allows reading, but not modification, of
data
• Insert authorization: which allows insertion of new data, but not
modification of existing data;
• Update authorization: which allows modification, but not deletion,
of data
• Delete authorization: which allows deletion of data.
31
1.4.2 The SQL Data-Definition Language
• SQL provides a rich DDL that allows one to define tables with data
types and integrity constraints.
33
1.4.3 Data-Manipulation Language
• A data-manipulation language (DML) is a language that enables
users to access or manipulate data as organized by the appropriate
data model.
select instructor.name
from instructor
35
1.4.4 The SQL Data-Manipulation Language
• Queries may involve information from more than one table.
36
1.4.5 Database Access from Application
Programs
• Application programs are programs that are used to interact with
the database in this fashion.
37
1.4.5 Database Access from Application
Programs
• To access the database, DML statements need to be sent from the
host to the database where they will be executed.
38
1.5 Database Design
Initial (a
specification of Conceptual-design
user requirements) phase
phase
Logical-design Physical-design
phase phase
39
1.5 Database Design
• The (1) initial phase of database design, then, is to characterize fully
the data needs of the prospective database users.
40
1.5 Database Design
• Initial Phase (User Requirements)
41
1.5 Database Design
• Next, the designer chooses a data model, and by applying the
concepts of the chosen data model, translates these requirements
into a conceptual schema of the database. The schema developed at
this (2) conceptual-design phase provides a detailed overview of the
enterprise.
42
1.5 Database Design
• conceptual-design phase (E-R Diagram)
43
1.5 Database Design
• The process of moving from an abstract data model to the
implementation of the database proceeds in two final design phases.
44
1.5 Database Design
• logical-design phase (Relation Model)
45
1.5 Database Design
• The designer uses the resulting system-specific database schema in
the subsequent (4) physical-design phase, in which the physical
features of the database are specified.
46
1.5 Database Design
• physical-design phase
CREATE TABLE vaccine (
vaccine_id INT NOT NULL,
khmer_first_name INT NOT NULL,
latin_first_name INT NOT NULL,
latin_last_name INT NOT NULL,
id_card INT NOT NULL,
phone_number INT NOT NULL,
created_at INT NOT NULL,
updated_at INT NOT NULL,
PRIMARY KEY (vaccine_id)
); 47
1.5 Database Design
• physical-design phase
CREATE TABLE vaccine_informations(
vaccine_id INT NOT NULL,
phase INT NOT NULL,
vaccine_name INT NOT NULL,
location INT NOT NULL,
vaccine_date INT NOT NULL,
created_at INT NOT NULL,
updated_at INT NOT NULL,
FOREIGN KEY (vaccine_id) REFERENCES
vaccine(vaccine_id)
); 48
Reference
• Abraham Siberschatz, Henry F. Korth,
S. Sudarshan (2019). Database System
Concepts (7th Edition). McGraw-Hill
Education. ISBN 9780078022159
49