0% found this document useful (0 votes)
1 views

Chapter2

Uploaded by

Khaled Salah
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)
1 views

Chapter2

Uploaded by

Khaled Salah
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/ 33

Chapter 2

Database System Concepts and


Architecture

Dr. Khaled Wassif


Fall 2020-2021
DB 1

(This is the instructor’s notes and student has to


read the textbook for complete material.)
Chapter Outline
◼ Data Models and Their Categories
◼ History of Data Models
◼ Schemas, Instances, and States
◼ Three-Schema Architecture
◼ Data Independence
◼ DBMS Languages and Interfaces
◼ Database System Utilities and Tools
◼ Classification of DBMSs
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 2
Modified By Dr. Khaled Wassif
Data Models
◼ Data Model:
– A collection of concepts that can be used to describe:
» the structure of a database,
» the operations for manipulating these structure, and
» the constraints that the database should obey.
◼ Data Model Structure and Constraints:
– Constructs are used to define the database structure.
– Constructs typically include elements as well as groups of
elements (e.g. entity, record, table), and relationships
among such groups.
– Constraints specify some restrictions on valid data; these
constraints must be enforced at all times.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3
Modified By Dr. Khaled Wassif
Data Models (continued)
◼ Data Model Operations:
– These operations are used for specifying database retrievals
and updates by referring to the constructs of the data
model.
– Operations on the data model may include:
» basic model operations (e.g. generic insert, delete, update), and

» user-defined operations (e.g. compute_student_gpa,


update_inventory).

– Object oriented Data Model can include set of user defined


operations within the data model.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4
Modified By Dr. Khaled Wassif
Categories of Data Models
◼ Data Models are categorized, according to the types of
concepts used to describe the database structure, into
these three categories:
– Conceptual (high-level, semantic) data models:
» Provide concepts that are close to how the users perceive data.

» uses concepts such as:

◼ Entities: represent real world objects as students, courses, projects, etc.

◼ Attributes: represent properties of the entity as names, scores, Tel, etc.

◼ Relationships: represent associations among two or more entities to


denote the interaction between them as enrolled-in relation between
student and courses entities.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 5
Modified By Dr. Khaled Wassif
Categories of Data Models (cont.)
– Physical (low-level, internal) data models:
» Provide concepts that describe details of how data is stored as files in
the computer.
» Representing information such as record formats, record orderings
and access path to mange the data efficiently.
» Generally meant for computer specialists, not for typical end users.
– Implementation (representational) data models:
» Provide concepts that fall between the above two data models.
» Include concepts that can be understood by end user but not far from
some details of the physical representations.
» Used by most of the traditional DBMSs (as the widely used relational
data models and the legacy network and hierarchical data models).
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 6
Modified By Dr. Khaled Wassif
Schemas, Instances, and
Database State
◼ The description of a database is called Database Schema.
– The schema is specified during the database design.
– The schema is not expected to be changed frequently.
– Each object of a schema (e.g., STUDENT, COURSE) is called
schema construct.
– The schema is called the “intension”.
– The schema description, stored in the DBMS catalog, is called
the “meta-data”.
– The schema is usually represented by a diagram called
Schema diagram.
– A schema diagram displays only some aspects of a schema (as
names of record types and data items) and some other aspects
(as data types and relationships) are not specified.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 7
Modified By Dr. Khaled Wassif
Example of a Database Schema

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 8


Modified By Dr. Khaled Wassif
Schemas, Instances, and
Database State (cont.)
◼ The actual data in the database at a particular moment
in time is called a Database State.
– The database state includes the collection of all the data in
the database.
– The database state changes every time the database is
updated.
– The database state is called the “extension”.
– Also called database instance (or occurrence or snapshot).
– Initial state of a database refers to the state when it is first
loaded with the initial data.
– Valid database state is a state that satisfies the structure and
constraints specified in the database schema.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 9
Modified By Dr. Khaled Wassif
Example of a database state

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 10


Modified By Dr. Khaled Wassif
Three-Schema Architecture
◼ Proposed to achieve DBMS characteristics of:
– Program-data independence.
– Support of multiple views of the data.
◼ Not explicitly used in commercial DBMS products,
but has been useful in explaining the database system
organization.
◼ Defines DBMS schemas at three levels:
– Internal schema at the internal level to describe physical
storage structures of the database.
» Typically uses a physical data model.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 11


Modified By Dr. Khaled Wassif
Three-Schema Architecture (cont.)
– Conceptual schema at the conceptual level to describe the
structure and constraints for the whole database for a
community of users.
» Uses a conceptual or an implementation data model.

– External schemas at the external level to describe the


various user views.
» Each user view describes a part of the database that is interested to a
particular user group.
» Usually uses the same data model as the conceptual schema.

◼ DBMSs perform mappings to transform requests and


results between the levels.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 12
Modified By Dr. Khaled Wassif
The three-schema architecture

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 13


Modified By Dr. Khaled Wassif
Three-Schema Architecture (cont.)
◼ Some DBMSs may include physical details in the
conceptual schema.
◼ Most of the DBMSs include external views in the
conceptual data model.
◼ Programs refer to an external schema, and are mapped
by the DBMS to the internal schema for execution.
◼ Data extracted from the internal DBMS level is
reformatted to match the user’s external view.
◼ Mappings between levels is a time-consuming process,
so some DBMSs do not support the external views.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 14
Modified By Dr. Khaled Wassif
Data Independence
◼ Defined as the capacity to change the schema at one
level of a database without having to change the
schema at the next higher level.
– The mapping between the levels is only changed to reflect
the change of the schema.
◼ There are two types of data independence:
– Logical Data Independence:
» The ability to change the conceptual schema without having to
change the external schemas and their associated application
programs.
– Physical Data Independence:
» The ability to change the internal schema without having to change
the conceptual schema.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 15
Modified By Dr. Khaled Wassif
Data Independence (cont.)
◼ Conceptual schema may be changed to expand the
database by adding new data items or reducing it by
removing data items.
─ The applications involved in the modified data items can only
changed without any effect on the remaining applications.
◼ Internal schema may be changed, due to some file
reorganization or new indexes are created, to improve
database performance.
◼ The three-schema architecture can make it easier to
achieve true data independence, both physical or logical.
─ However, the two levels of mappings create an overhead
during execution of a query, leading to inefficient DBMS.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 16
Modified By Dr. Khaled Wassif
DBMS Languages
◼ Data Definition Language (DDL):
– Used by the DBA and database designers to specify the
conceptual schema of a database.
– In many DBMSs, the DDL is also used to define internal and
external schemas (views).
– In some DBMSs, other two languages are used to define
internal and external schemas:
» Storage Definition Language (SDL) is used to define internal
schema, and
» View Definition Language (VDL) is used to define external schemas.
– DDL compiler is exist to process DDL statements and store
the schema description in the DBMS catalog.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 17
Modified By Dr. Khaled Wassif
DBMS Languages (cont.)
◼ Data Manipulation Language (DML):
– Used to specify database retrievals and updates.
– There two types of DMLs
» High-Level or Non-procedural Languages:
◼ May be used in a standalone way or may be embedded in a general-
purpose programming language such as COBOL, C, C++, or Java.
◼ can specify and retrieve many records in a single statement (set-at-a-time).
◼ If used in a stand-alone interactive manner, it is called Query language.
» Low Level or Procedural Languages:
◼ These must be embedded in a programming language.
◼ It retrieves individual records separately (record-at-a time).
– In both types of DML languages the programming language
is called host language and DML is called sublanguage.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 18
Modified By Dr. Khaled Wassif
DBMS Interfaces
◼ Stand-alone query language interfaces:
– Used by casual end users to specify their requests.
– Example: Entering SQL queries at the DBMS interactive
SQL interface (e.g. SQL*Plus in ORACLE).
◼ Programmer interfaces:
– Embedded Approach:
» e.g embedded SQL (for C, C++, etc.), SQLJ (for Java).
– Procedure Call Approach:
» e.g. JDBC for Java, ODBC for other programming languages.
– Database Programming Language Approach:
» e.g. ORACLE has PL/SQL like a programming language that
incorporates SQL and its data types as integral components.
◼ User-friendly interfaces
– For naïve users as menu-based, forms-based, GUI, etc.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 19
Modified By Dr. Khaled Wassif
User-Friendly DBMS Interfaces
◼ Menu-based interfaces:
– They present the user with lists of menus to formulate his
request.
– The menus generate the request and send it to the DBMS.
◼ Form-based interfaces:
– They display forms to users to help them in entering new
data or retrieving required data.
– It is usually used with naïve users of canned transactions.
◼ Graphical user interfaces:
– They display the schema in diagrammatic form where users
can specify their queries by manipulating these diagrams.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 20
Modified By Dr. Khaled Wassif
User-Friendly DBMS Interfaces (cont.)
◼ Natural language interfaces:
– They accept requests written in English (or any other)
language to from the query.
– The users use the conceptual schema and some predefined
words to construct their requests.
◼ Interfaces for parametric users:
– They are usually a simple interface with some abbreviated
commands to minimize the user keystrokes.
– Functions keys are typically programmed in these
interfaces to help the users in performing their requests.
◼ Interfaces for the DBA:
– Special interfaces for the DBAs to perform their privileged
commands (as creating users, granting authorizations).
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 21
Modified By Dr. Khaled Wassif
Database System Environment
◼ DBMS is a complex software which includes many
modules that support all user and system DB functions:
– Operating system controls the disk access functions.
– DDL compiler performs schema definitions and loads the
data description information into the database catalog.
– Run-time DB processor handles the database accesses at
run time.
– Query Compiler handles high-level queries by parsing,
analyzing and compiling their statements and then calls the
Run-time processor to execute it.
– Pre-compiler extracts the DML commands from the host
language.
– DML compiler compiles the DML to build the code which
is passed to the Run-time processor for execution.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 22
Modified By Dr. Khaled Wassif
Typical DBMS Component Modules

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 23


Modified By Dr. Khaled Wassif
Database System Utilities
◼ Most of DBMSs have some utilities that help
DBA in managing his database system as the
following types of functions:
– Loading data stored in files into a database which
includes data conversion tools.
– Backing up the database periodically on tape.
– Reorganizing database file structures.
– Report generation utilities.
– Performance monitoring utilities.
– Other functions, such as sorting, user monitoring,
data compression, etc.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 24
Modified By Dr. Khaled Wassif
Other Tools
◼ Data dictionary / repository:
– Used to store schema descriptions and other information
such as design decisions, application program descriptions,
user information, usage standards, etc.
◼ Application Development Environments and
CASE (computer-aided software engineering) tools:
– Examples:
» PowerBuilder (Sybase)
» JBuilder (Borland)
» Jdeveloper (Oracle)
◼ Communication software:
– Used to allow users at locations remote from the database
system site to access the database.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 25
Modified By Dr. Khaled Wassif
Classification of DBMSs
Criteria Categories
Relational – Object oriented – Object Relational – Network
Data Model
– Hierarchical

# of users Single user – Multiuser

Centralized – Distributed (Homogeneous – Heterogeneous)


# of sites
– Client-Server
$100-$3000 (single user) - $10,000-$100,000 -
Cost
$100,000 and more

Purpose General-purpose - Special-purpose

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 26


Modified By Dr. Khaled Wassif
History of Data Models
◼ Network Model
◼ Hierarchical Model
◼ Relational Model
◼ Object-oriented Data Models
◼ Object-Relational Models

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 27


Modified By Dr. Khaled Wassif
History of Data Models
◼ Network Model:
– The first network DBMS was implemented by Honeywell
in 1964-65 (IDS System).
– Later implemented in a large variety of systems – IDMS,
DMS 1100, IMAGE, VAX – DBMS.
– Advantages:
» Able to model complex relationships.
» Can handle most situations for modeling using record types and
relationship types.
– Disadvantages:
» Navigational and procedural nature of processing.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 28
Modified By Dr. Khaled Wassif
Example of Network Model Schema

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 29


Modified By Dr. Khaled Wassif
History of Data Models
◼ Hierarchical Model:
– Hierarchical model was formalized based on the IMS
system which initially implemented by IBM around 1965.
– IBM’s IMS product still has a very large customer base
worldwide.
– Advantages:
» Simple to construct and operate.
» Corresponds to a number of natural hierarchically organized
domains, e.g., organization chart.
– Disadvantages:
» Navigational and procedural nature of processing.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 30
Modified By Dr. Khaled Wassif
History of Data Models
◼ Relational Model:
– Proposed in 1970 by IBM and first commercial system in
1981-82.
– Now in several commercial products (e.g. DB2, ORACLE,
MS SQL Server, SYBASE, INFORMIX).
– Several free open source implementations, e.g. MySQL.
– Currently most dominant for developing database
applications.
– SQL relational standards: SQL-89 (SQL1), SQL-92
(SQL2), SQL-99, SQL3, …
– Chapters 5 through 11 describe this model in detail.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 31
Modified By Dr. Khaled Wassif
History of Data Models
◼ Object-oriented Data Models:
– Several models have been proposed for implementing in a
database system.
– One set comprises models of persistent O-O Programming
Languages such as C++ (e.g., in OBJECTSTORE or
VERSANT), and Smalltalk (e.g., in GEMSTONE).
◼ Object-Relational Models:
– Relational systems incorporate concepts from object
databases leading to object-relational.
– Exemplified in the latest versions of Oracle-10i, DB2, and
SQL Server and other DBMSs.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 32
Modified By Dr. Khaled Wassif
Summary
◼ Data Models and Their Categories
◼ History of Data Models
◼ Schemas, Instances, and States
◼ Three-Schema Architecture
◼ Data Independence
◼ DBMS Languages and Interfaces
◼ Database System Utilities and Tools
◼ Classification of DBMSs

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 2- 33


Modified By Dr. Khaled Wassif

You might also like