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

Chapter 2 Database_System Part I

Uploaded by

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

Chapter 2 Database_System Part I

Uploaded by

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

Chapter-2

Database System Concepts and Architecture

1
Chapter 2 Topics
• Database System Concepts and Architecture
• Data Models, Schemas and Instances
• Three-Schema Architecture and Data Independence
• Database Languages and Interfaces
• The Database System Environment
• Centralized and Client/Server Architectures for DBMSs
• Classification of Database Management Systems
• Functions of DBMS

2
Data Models
 Data models define how the logical structure of a database
is modeled.
 Data Models are fundamental entities to introduce
abstraction in a DBMS.
 Data models define how data is connected to each other and
how they are processed and stored inside the system.

3
conts..
• Data Model: a set of concepts to describe the structure
of a database, and certain constraints that the database
should obey.
• A data model is a description of the way that data is
stored in a database.
• Data model helps to understand the relationship
between entities and to create the most effective
structure to hold data.
• Data Model is a collection of tools or concepts for
describing
– Data
– Data relationships
– Data semantics
– Data constraints
• The main purpose of Data Model is to represent the data
in an understandable way. 4
Categories of database models include:
– 1. Record-based
– 2. Object-based
– 3. Physical

5
1. Record-based Data Models
• Consist of a number of fixed format records. Each record type
defines a fixed number of fields, Each field is typically of a fixed
length. The following are examples of this database
model category.
– Hierarchical Database Model
– Network Database Model
– Relational Database Model

6
Hierarchical model
• In hierarchical model, data is organized into a tree like

structure with each record is having one parent record and

many children.

• Records are linked together like an organizational chart

• Each record type has only one owner

• The main drawback of this model is that, it can have only one

to many relationships between nodes.

7
Example of Hierarchical Model
• Lets say we have few students and few courses and a
course can be assigned to a single student only,

• however a student take any number of


courses so this relationship becomes one to
many.

8
Example of Hierarchical Model (Cont..)

9
Hierarchical model (Cont..)
• The simplest database model

• Hierarchical upside-down tree structure. The tree may be of


arbitrary depth

• Each record contain multiple fields, where each field may


contain either data values like integer, real, text or a pointer to a
record.

• A parent node can have more than one child node

• A child node can only have one parent node

• The relationship between parent and child is one-to-many and


one-to-one 10
Advantages
• Hierarchical Model is simple to construct

• Conceptual simplicity – easy to understand the model layout

• Data independence Database integrity – always a link


between parent and child

• Efficiency – very efficient when it contains a large volume


of data in 1:M relationships and whose relationships are
fixed over time

11
Disadvantages
 Complex implementation – detailed knowledge of the
physical data storage characteristics is required by the
designers and programmers

 Difficult to manage – relocation of segments requires


application changes
 Lacks structural independence
 Complex applications programming and use
 programmers and end users must know precisely how
the data are physically distributed within the database
 Lack of standards – no standard DDL and no DML
12
Disadvantages (Cont…)
• Implementation limitations – difficult to support
M:N relationships
• A child node in the tree cannot have more than one parent.

• So, if the same account is associated with 2 customers (e.g. a


husband and wife have a joint account and also separate
accounts), we cannot link the one account record to 2 different
customer records. But we can have the account record appearing
in two tree branches. This can lead to duplicated data – and
inconsistent data, if the account is not updated in all the branches.

13
Network Model
• Network Model is same as hierarchical model except that
it has graph-like structure rather than a tree-based
structure.
• Unlike hierarchical model, this model allows each record to
have more than one parent record.
• The Network Database Model to allow multiple records to
be linked to the same owner file creating a many-to-many
relationship rather than a one-to-many.
• Represents complex data relationships more effectively than
the hierarchical model
14
Network Model (Cont..)
• Like hierarchical model network model is a collection of
physically linked records.

• Collection of records in N:M relationships

– Composed of at least two record types

• Owner

– Equivalent to the hierarchical model’s parent

• Member

– Equivalent to the hierarchical model’s child

– A record can appear as a member in more than one


set i.e., a member may have multiple owners 15
• The network data model can be
represented as −

16
Example of Network Data Model

Network Data Model

52

17
Advantages
• Conceptual simplicity

• Handles more relationship types

• Data access flexibility – no need for a preorder traversal

• Promotes database integrity – must first define the owner


and then the member record

• Data independence

• Network Model is able to model complex relationships and r


epresents semantics
18
Disadvantages
• System complexity

• Navigational and procedural nature of processing.

• Database contains a complex array of pointers that thread


through a set of records.

• Little scope for automated "query optimization”

19
Relational Model
• Stores information or data in the form of tables rows and
columns.
• A row of the table is called tuple equivalent to record.
• A column of a table is called attribute equivalent to fields.
• Data value is the value of the Attribute.
• Records are related by the data stored jointly in the fields of
records in two tables or files.
• The related tables contain information that creates the
relation.

20
Relational Model (Cont..)

21
Advantages
• Structural independence – changes in the relational data
structure do not affect the DBMS’s data access in any way
• Improved conceptual simplicity by concentrating on the
logical view
• Easier database design, implementation, management, and
use
• Ad hoc query capability - SQL
• Powerful database management system

22
Disadvantages

• Substantial hardware and system software overhead

• Can facilitate poor design and implementation

23
2. Object Oriented Model
• Modeled both data and their relationships in a single
structure known as an object

• Basis of object oriented data model (OODM)

• OODM becomes the basis for the object oriented database


management system (OODBMS)

24
Object Oriented Model (Cont..)
• Object: abstraction of a real-world entity.

• Attributes describe the properties of an object.

• Objects that share similar characteristics are


grouped in classes.

• Classes are organized in a class hierarchy.

• Inheritance is the ability of an object within the


class hierarchy to inherit the attributes and
methods of classes above it.

25
Advantages
• -Adds semantic content
• -Visual presentation includes semantic content
• -Database integrity
• -Both structural and data independence
Disadvantages
• -Slow pace of OODM standards development
• -Complex navigational data access
• --High system overhead slows transactions
• -Lack of market penetration
26
Object relational
• An Object relational model is a combination of a Object
oriented database model and a Relational database model.

• So, it supports objects, classes, inheritance etc. just like Object


Oriented models and has support for data types, tabular
structures etc. like Relational data model.

• One of the major goals of Object relational data model is to


close the gap between relational databases and the object
oriented practices frequently used in many programming
languages such as C++, C#, Java etc.
27
Object relational (Cont..(

28
Schemas versus Instances
• Database Schema: The description of the database. It rarely
changes.

– Includes descriptions of the database structure, data types,


and the constraints on the database.

• Database Instance (snapshot): The actual data stored in a


database at a particular moment in time. Changes rapidly.

• The concepts of Schema & Instances corresponds to Types


& Values in programming languages, respectively.

29
Example
Schema

30
Instance

31
Architecture of DBMS
• The Database Management System (DBMS) architecture
shows how data in the database is viewed by the users.
• It is not concerned about how the data are handled and
processed by the DBMS.

• It helps in implementation, design, and maintenance of a


database to store and organize information for companies

32
The Three-Level ANSI-SPARC Architecture

• ANSI-SPARC stands for (American National Standards Institute,


Standards Planning And Requirements Committee) is an abstract
design standard for a Database Management System (DBMS)

33
• This architecture contains three layers of database management
system, which are as follows −

• External level

• Conceptual level

• Internal level

34
ANSI-SPARC Three-Level Architecture

How the
user is
viewing the
data
What data is stored

How data is stored


Where is it stored

35
ANSI-SPARC Three-Level Architecture

• External Level/View Level


– Users’ view of the database.
– Describes that part of database that is relevant to a particular
user.
– This is the highest level of database abstraction.
– It includes a number of external schemas or user views.
– This level provides different views of the same database for a
specific user or a group of users.
– An external view provides a powerful and flexible security
mechanism by hiding the parts of the database from a particular
user.
36
Conceptual Level
• It acts as a middle layer between the physical storage and user
view.
• This level describes the structure of the whole database.
• There is only one conceptual schema per database.
• It explains what data to be stored in the database, what the data
types are, and what relationship exists among those data.
• Describes what data is stored in database and relationships
among the data it represents the following
 All the entities, attributes and their relationships.
 The constraints on the data.
 Security and integrity information
37
Internal or Physical level

• This is the lowest level of database abstraction.

• It describes how the data is stored in the database and provides

the methods to access data from the database.

• It allows viewing the physical representation of the database on

the computer system.

• The internal schema not only defines different stored record

types, but also specifies what indices exist, how stored fields are

represented. It covers the data structure and file organization

used to store the data on storage devices.


38
Differences between Three Levels

39
Schemas, Mappings, and Instances

• Mapping is the process of transforming requests and results


between the Internal, Conceptual & External levels.
o Programs refer to an external schema, and are mapped by
the DBMS to the internal schema for execution.
o Data extracted from the internal DBMS level is reformatted to
match the user’s external view.

Two types of mapping:

• External / Conceptual mapping.

• Conceptual / Internal mapping.


40
Data Independence

• Means : upper levels are unaffected by changes to lower


levels.

• Two kinds of data independence: logical and physical.

41
Data Independence
• Logical Data Independence
– Refers to protection of external schemas to changes in
conceptual schema.
– Conceptual schema changes (e.g. addition/removal of
entities).
– Should not require changes to external schema or
rewrites of application programs.

42
Data Independence

• Physical Data Independence

– Refers to immunity of conceptual schema to changes in


the internal schema.

– Internal schema changes (e.g. using different file


organizations, storage structures/devices).

– Should not require change to conceptual or external

schemas.

43
Data Independence and the ANSI-SPARC Three-Level
Architecture

44
Database Languages and Interfaces
• Data Definition Language (DDL)
– Allows the DBA or user to describe and name entities, attributes,
and relationships required for the application together with any
associated integrity and security constraints.
– DDL is a descriptive language for defining and constructing the
database.
– Allows users to specify the data types and structures and the
constraints on the data to be stored in the DB.
– DDL compiler generates the meta-data (describes objects in
database and make it easier for manipulation) that is stored in the
data dictionary.
45
• The DDL used to define and change the conceptual schema
of the database

• The DDL is used to name entities, attributes and relationships


to together with any related constraint and security
constraints

• The following are DDL command:


– CREATE
– ALTER
– DROP
– TRANCATE
– RENAME|
46
Database Languages
• Data Manipulation Language (DML)
• Provides basic data manipulation operations on data held in
the database.
• DML is a language for retrieving and updating (insert, delete, & modify)
the data in the DB. It is called Query language.
• The DML is used at the conceptual and view levels to retrieve, insert ,
delete , modify information stored in database
The following are DML commands:
• SELECT • DELETE • EXPLAIN PLAN
• INSERT
• MERGE • LOCK TABLE
• UPDATE
• CALL
47
Database Languages

• Both DDL and DML are usually not considered


distinct languages. Rather, they are included in a
comprehensive integrated language.

• For example, SQL relational database


language is a comprehensive DB language which
represents a combination of DDL and DML.

48
DCL-Data Control Language
• GRANT-Used to give access privileges to a database
• REVOKE-Use to take back permission from the user.
TCL – Transaction control Language

• Used to run the changes made by the DML statement.

• TCL Commands:
– Commit;-used to save the transaction on the database

– Rollback-used to restore the database to the original since the last


commit.

49
Database system Environment
What is a Database Environment?
• A database environment is a collective system of
components that comprise and regulates the
group of data, management, and use of data, which
consist of :
– Hardware
– Software
– People
– Procedures
– Data

50
Hardware
• It identifies all the system’s physical devices.
• The database system’s main and most easily
identified hardware component is the computer,
which might be a microprocessor, a
minicomputer, or a mainframe computer.
• It also include peripherals like keyboard, mice,
modems, printers, etc.

51
Software
• Software refers to the collection of programs used
by the computers within the database system.

• Operating system Software- manages all hardware


components and makes it possible for all other
software to run on the computers.

• DOS,OS/2, and Windows used by micro computers.


UNIX and VMS used by mini computers, and MVS
used by IBM mainframe computers
52
DBMS Software- manages the database within the
database system.
MS-Access, MSSQL Server, Oracle, DB2 etc. are some famous
DBMS software.
Application Programs & Utilities
Software- are used to access and manipulate the data in the
DBMS to manage the computer environment in which data access
and manipulation take place.

53
People
System Administrator: supervise the database system’s general
operations.
Database Administrator: manage the DBMS’s use and ensure that the
database is functioning properly.
Database Designers: design the database structure.
System Analysts and Programmers: design and implement the
application programs.
End Users: are the people who use the application programs to run
the organization’s daily operations. E.g. sales clerks, supervisors,
managers, and directors are all classified as end users
54
Procedures
• Procedures are the instructions and rules that govern the design
and use of the database system.
• Procedure are a critical, although occasionally forgotten, component
of the system.
• Procedures play a very important role in a company, because they
enforce the standards by which business is conducted within the
organization and with customers.
• These also are used to ensure that there is an organized way to
monitor and audit both the data and information.

55
Data
• The word “data” covers the collection of facts stored in the
database.

• Because data are the raw material from which information is


generated, the determination of which data are to be entered
into the database and how such data are to be organized is a
vital part of the database designer’s job.

56
NEXT Topic

DBMS Functions

57

You might also like