Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
25 views

DBMS Chapter 2

Uploaded by

Abinet Arba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

DBMS Chapter 2

Uploaded by

Abinet Arba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter two

Database System Architecture


Outline
 Data Models, Schema and Instances
 DBMS Architecture and Data
Independence
 Database Language and Interface
 The Database System Environment
 Classification of DBMS

1
 The architecture of DBMS packages has evolved from
the early monolithic systems, where the whole DBMS
software package was one tightly integrated system, to
the modern DBMS packages that are modular in design,
with a client/server system architecture.
 In a basic client/server DBMS architecture, the system
functionality is distributed between two types of
modules. A client module is typically designed so that it
will run on a user workstation or personal computer.
Typically, application programs and user interfaces that
access the database run in the client module.
 The other kind of module, called a server module,
typically handles data storage, access, search, and other
functions. We discuss client/server architectures in
more detail.

2
Data Models, Schema and Instances
 One fundamental characteristic of the database approach
is that it provides some level of data abstraction. Data
abstraction generally refers to the suppression of details
of data organization and storage, and the highlighting of
the essential features for an improved understanding of
data.
 A data model—a collection of concepts that can be used
to describe the structure of a database. By structure of a
database we mean the data types, relationships, and
constraints that apply to the data. Most data models also
include a set of basic operations for specifying retrievals
and updates on the database.

3
Cont’d………………………
Categories of Data Models
Many data models have been proposed, which we can
categorize according to the types of concepts they use to
describe the database structure. High-level or conceptual data
models provide concepts that are close to the way many users
perceive data, whereas low-level or physical data models
provide concepts that describe the details of how data is stored
on the computer storage media.
Between these two extremes is a class of representational (or
implementation) data models,4 which provide concepts that may
be easily understood by end users but that are not too far
removed from the way data is organized in computer storage.

4
Cont’d……….
Conceptual data models use concepts such as entities, attributes, and
relationships.
An entity represents a real-world object or concept, such as an
employee or a project from the mini world that is described in the
database.
An attribute represents some property of interest that further describes
an entity.
A relationship among two or more entities represents an association
among the entities.
Representational or implementation data models are the models used
most frequently in traditional commercial DBMSs. These include the
widely used relational data model, as well as the so-called legacy data
models—the network and hierarchical models—that have been widely
used in the past. Representational data models represent data by using
record structures and hence are sometimes called record-based data
models.

5
Cont’d…
Entity Set or Entity Type-Collection of entities all having the same
properties.
Student entity set – collection of all student entities.
Course entity set – collection of all course entities.
Simple Attributes
ƒhaving atomic or indivisible values.
example: Dept – a string
Phone Number – an eight digit number
Composite Attributes
ƒhaving several components in the value.
example: Qualification with components
(Degree Name, Year, University Name)
Derived Attributes
ƒAttribute value is dependent on some other attribute.
example: Age depends on Date Of Birth.
So age is a derived attribute. 6
Cont’d………
Single-valued
ƒhaving only one value rather than a set of values.
ƒfor instance, Place Of Birth – single string value.
Multi-valued
ƒhaving a set of values rather than a single value.
ƒfor instance, Courses Enrolled attribute for student
Email Address attribute for student
Previous Degree attribute for student.
Attributes can be:
ƒsimple single-valued, simple multi-valued,
ƒcomposite single-valued or composite multi-valued.

7
Cont’d………
Physical data models describe how data is stored as files in the
computer by representing information such as record formats, record
orderings, and access paths. An access path is a structure that makes
the search for particular database records efficient. An index is an
example of an access path that allows direct access to data
using an index term or a keyword.
In any data model, it is important to distinguish between the
description of the data-base and the database itself. The description of
a database is called the database schema, which is specified during
database design and is not expected to change frequently. Most data
models have certain conventions for displaying schemas as diagrams.
A displayed schema is called a schema diagram.

8
Cont’d……………..
A schema diagram displays only some aspects of a schema, such as
the names of record types and data items, and some types of
constraints.
The data in the database at a particular moment in time is called a
database state or snapshot. It is also called the current set of
occurrences or instances in the database. Example for schema
Student

Name Student_number Class Major

Corse

Course_name Course_number Credit_hours

9
Cont’d………….
In a given database state, each schema construct has its own current set
of instances; for example, the STUDENT construct will contain the
set of individual student entities (records) as its instances. Many
database states can be constructed to correspond to a particular
database schema. Every time we insert or delete a record or change the
value of a data item in a record, we change one state of the database
into another state.
The distinction between database schema and database state is very
important. When we define a new database, we specify its database
schema only to the DBMS. At this point, the corresponding database
state is the empty state with no data. We get the initial state of the
database when the database is first populated or loaded with the initial
data.

10
Cont’d…………
From then on, every time an update operation is applied to
the database, we get another database state. At any point in
time, the database has a current state. The DBMS is partly
responsible for ensuring that every state of the database is
a valid state—that is, a state that satisfies the structure and
constraints specified in the schema.
The schema is sometimes called the intension, and a
database state is called an extension of the schema.
Although, as mentioned earlier, the schema is not supposed
to change frequently, it is not uncommon that changes
occasionally need to be applied to the schema as the
application requirements change.

11
Cont’d………..
For example, we may decide that another
data item needs to be stored for each record
in a file, such as adding the Date_of_birth
to the STUDENT schema . This is known as
schema evolution. Most modern DBMSs
include some operations for schema
evolution that can be applied while the
database is operational.

12
Diagrammatic Notation for Entities
entity - rectangle
attribute - ellipse connected to rectangle
multi-valued attribute - double ellipse
composite attribute - ellipse connected to
ellipse
derived attribute - dashed ellipse
example

13
Key – an attribute or a collection of attributes whose value(s)
uniquely identify an entity in the entity set. A key for an entity set may
have more than one attribute.
Super Key is any combination of fields within a table that uniquely
identifies each record within that table.
Candidate Key is a subset of a super key. A candidate key is a single
field or the least combination of fields that uniquely identifies each
record in the table. The least combination of fields distinguishes a
candidate key from a super key.
Primary Key is a candidate key that is most appropriate to be the
main reference key for the table. As its name suggests, it is the primary
key of reference for the table and is used throughout the database to
help establish relationships with other tables.
Foreign Key is generally a primary key from one table that appears as
a field in another where the first table has a relationship to the second.
In other words, if we had a table A with a primary key X that linked to
a table B where X was a field in B, then X would be a foreign key in
B.

14
Relationship
An entity set may have more than one key.
Keys can be determined only from the meaning of the
attributes in the entity type. Relationships
When two or more entities are associated with each
other, we have an instance of a Relationship. Degree of
a relationship
Degree : the number of participating entities.
Degree 2: binary
Degree 3: ternary
Degree n: n-ary
Binary relationships are very common and widely used.

15
Diagrammatic Notation for Relationships
ƒRelationship – diamond shaped box
ƒRectangle of each participating entity is connected by a line to
this diamond. Name of the relationship is written in the box. Binary
Relationships and Cardinality Ratio
E1 E2R
• The number of entities from E2 that an entity from E1 can
possibly be associated thru R (and vice-versa) determines
the cardinality ratio of R.

16
Cardinality Ratios
• One-to-one: An E1 entity may be associated with at
most one E2 entity and similarly an E2 entity may be
associated with at
most one E1 entity.
• One-to-many: An E1 entity may be associated with
many E2 entities whereas an E2 entity may be associated
with at most one E1 entity.
• Many-to-one: … ( similar to above)
• Many-to-many: Many E1 entities may be associated with
a single E2 entity and a single E1 entity
may be associated with many E2 entities.
example
17
Participation Constraints
• An entity set may participate in a relation either totally or
partially.
• Total participation: Every entity in the set is involved in some
association (or tuple) of the relationship.
• Partial participation: Not all entities in the set are involved in
association (or tuples) of the relationship. Example
Weak Entity Sets
Weak Entity Set: An entity set whose members owe their
existence to some entity in a strong entity set.
ƒentities are not of independent existence.
ƒeach weak entity is associated with some entity of the
owner entity set through a special relationship.
ƒweak entity set may not have a key attribute. Example
18
DBMS Architecture and Data
Independence
The goal of the three-schema architecture is to separate the user
applications from the physical database.
1,The internal level has an internal schema, which describes the
physical storage structure of the database. The internal schema
uses a physical data model and describes the complete details of
data storage and access paths for the database.
2,The conceptual level has a conceptual schema, which
describes the structure of the whole database for a community of
users. The conceptual schema hides the details of physical
storage structures and concentrates on describing entities, data
types, relationships, user operations, and constraints.

19
Usually, a representational data model is used to
describe the conceptual schema when a database system
is implemented. This implementation conceptual
schema is often based on a conceptual schema design in
a high-level data model.
3. The external or view level includes a number of
external schemas or user views. Each external schema
describes the part of the database that a particular user
group is interested in and hides the rest of the database
from that user group. As in the previous level, each
external schema is typically implemented using a
representational data model, possibly based on an
external schema design in a high-level data model.

20
Data independence
The three-schema architecture can be used to further explain the
concept of data independence, which can be defined as the capacity to
change the schema at one level of a database system without having to
change the schema at the next higher level. We can define two types of
data independence:
Logical data independence is the capacity to change the conceptual
schema without having to change external schemas or application
programs. We may change the conceptual schema to expand the
database (by adding a record type or data item), to change constraints,
or to reduce the database (by removing a record type or data item).
Physical data independence is the capacity to change the internal
schema without having to change the conceptual schema. Hence, the
external schemas need not be changed as well. Changes to the internal
schema may be needed because some physical files were reorganized

21
DBMS Languages
data definition language (DDL) is a computer language used to
create and modify the structure of database objects in a database.
storage definition language(SDL) is used to specify the internal
schema.
view definition language (VDL) is used to specify user views and
their mappings to the conceptual schema.
data manipulation language (DML) is a family of computer
languages including commands permitting users to manipulate data in
a database. This manipulation involves inserting data into database
tables, retrieving existing data, deleting data from existing tables and
modifying existing data.
There are two main types of DMLs. A high-level or nonprocedural
DML can be used on its own to specify complex database operations
concisely.
A low-level or procedural DML must be embedded in a general-
purpose programming language. This type of DML typically retrieves
individual records or objects from the database and processes each
separately. 22
DBMS Interfaces
Menu-Based Interfaces for Web Clients or Browsing. These
interfaces pre-sent the user with lists of options (called menus) that
lead the user through the formulation of a request. Menus do away
with the need to memorize the specific commands and syntax of a
query language.
Forms-Based Interfaces. A forms-based interface displays a form to
each user. Users can fill out all of the form entries to insert new data,
or they can fill out only certain entries, in which case the DBMS will
retrieve matching data for the remaining entries.
Graphical User Interfaces. A GUI typically displays a schema to the
user in diagrammatic form. The user then can specify a query by
manipulating the diagram.

23
Natural Language Interfaces. These interfaces accept requests
written in English or some other language and attempt to understand
them. A natural language interface usually has its own schema, which
is similar to the database conceptual schema, as well as a dictionary of
important words.
Speech Input and Output. Limited use of speech as an input query
and speech as an answer to a question or result of a request is
becoming common place.
Interfaces for Parametric Users. Parametric users, such as bank
tellers, often have a small set of operations that they must perform
repeatedly.
Interfaces for the DBA. Most database systems contain privileged
commands that can be used only by the DBA staff. These include
commands for creating accounts, setting system parameters, granting
account authorization, changing a schema, and reorganizing the
storage structures of a database.

24
The Database System Environment
DBMS Component Modules
Reading assignment

25
Database System Utilities
In addition to possessing the software modules just described, most
DBMSs have
database utilities that help the DBA manage the database system.
Common utilities
have the following types of functions:
■ Loading. A loading utility is used to load existing data files—such as
text
files or sequential files—into the database. Usually, the current
(source) format of the data file and the desired (target) database file
structure are speci-fied to the utility, which then automatically
reformats the data and stores it
in the database.

26
Backup. A backup utility creates a backup copy of the database, usually by
dumping the entire database onto tape or other mass storage medium. The
backup copy can be used to restore the database in case of catastrophic disk
failure. Incremental backups are also often used, where only changes since
the previous backup are recorded. Incremental backup is more complex, but
saves storage space.
■ Database storage reorganization. This utility can be used to reorganize a set
of database files into different file organizations, and create new access paths
to improve performance.
■ Performance monitoring. Such a utility monitors database usage and pro-vides
statistics to the DBA. The DBA uses the statistics in making decisions
such as whether or not to reorganize files or whether to add or drop indexes
to improve performance.

27
Tools, Application Environments,
and Communications Facilities
Other tools are often available to database designers, users, and the DBMS.
CASE tools are used in the design phase of database systems. Another tool
that can be quite useful in large organizations is an expanded data dictionary
(or data repository) system. In addition to storing catalog information about
schemas and constraints, the data dictionary stores other information, such as
design decisions, usage standards, application program descriptions, and user
information. Such a system is also called an information repository. This
information can be accessed directly by users or the DBA when needed. A data
dictionary utility is similar to the DBMS catalog, but it includes a wider
variety of information and is accessed mainly by users rather than by the
DBMS software.
Application development environments, such as PowerBuilder (Sybase) or
JBuilder (Borland), have been quite popular. These systems provide an
environment for developing database applications and include facilities that
help in many facets of database systems, including database design, GUI
development, querying and updating, and application program development.

28
The DBMS also needs to interface with communications
software, whose function is to allow users at locations
remote from the database system site to access the data-
base through computer terminals, workstations, or
personal computers. These are connected to the database
site through data communications hardware such as
Internet routers, phone lines, long-haul networks, local
networks, or satellite communication devices. Many
commercial database systems have communication
packages that work with the DBMS. The integrated
DBMS and data communications system is called a
DB/DC system. In addition, some distributed DBMSs are
physically distributed over multiple machines. In this
case, communications net-works are needed to connect
the machines. These are often local area networks
(LANs), but they can also be other types of networks.

29
Classification of DBMS
relational data model represents a database as a collection of tables,
where each table can be stored as a separate file. Most relational
databases use the high-level query language called SQL and support a
limited form of user views.
object data model defines a database in terms of objects, their
properties, and their operations. Objects with the same structure and
behavior belong to a class, and classes are organized into hierarchies
(or acyclic graphs). The operations of each class are specified in terms
of predefined procedures called methods.
The XML model has emerged as a standard for exchanging data over
the Web, and has been used as a basis for implementing several
prototype native XML systems. XML uses hierarchical tree structures.
It combines database concepts with concepts from document
representation models.

30
Two older, historically important data models, now known as legacy data
models, are the network and hierarchical models. The network model
represents data as record types and also represents a limited type of 1:N
relationship, called a set type. A 1:N, or one-to-many, relationship relates
one instance of a record to many record instances using some pointer
linking mechanism in these models. The hierarchical model represents
data as hierarchical tree structures. Each hierarchy represents a number
of related records. There is no standard language for the hierarchical
model.

31

You might also like