10
Database Architecture The Database Approach A database system is a computer-based system to record and maintain information. The information concerned can be anything of significance to the organization for whose use it is intended. The contents of a database can hold a variety of different things. To make database design more straight-forward, databases contents are divided up into two concepts: Schema Data The Schema is the structure of data, whereas the Data are the "facts". Schema can be complex to understand to begin with, but really indicates the rules which the Data must obey. DBMSs do not all conform to the same architecture. The three-level architecture forms the basis of modern database architectures. this is in agreement with the ANSI/SPARC study group on Database Management Systems. ANSI/SPARC is the American National Standards Institute/Standard Planning Three level database architecture: The objective of the three-level architecture is to separate the users’ view(s) of the database from the way that it is physically represented

Dbms architecture,dbms languages,data independence

Embed Size (px)

DESCRIPTION

Dbms architecture,dbms languages,data independence

Citation preview

Page 1: Dbms architecture,dbms languages,data independence

Database Architecture

The Database Approach

A database system is a computer-based system to record and maintain information. The information concerned can be anything of significance to the organization for whose use it is intended. The contents of a database can hold a variety of different things. To make database design more straight-forward, databases contents are divided up into two concepts:

Schema Data

The Schema is the structure of data, whereas the Data are the "facts". Schema can be complex to understand to begin with, but really indicates the rules which the Data must obey.

DBMSs do not all conform to the same architecture. The three-level architecture forms the basis of modern database

architectures. this is in agreement with the ANSI/SPARC study group on Database

Management Systems. ANSI/SPARC is the American National Standards Institute/Standard

Planning

Three level database architecture:The objective of the three-level architecture is to separate the users’ view(s) of the database from the way that it is physically represented

1. The external level : 2. The conceptual level : 3. The internal level

Page 2: Dbms architecture,dbms languages,data independence

External View Level: A user is anyone who needs to access some portion of the data. They

may range from application programmers to casual users with adhoc queries. Each user has a language at his/her disposal.

The application programmer may use a high level language (e.g. COBOL) while the casual user will probably use a query language.

Regardless of the language used, it will include a data sublanguage DSL which is that subset of the language which is concerned with storage and retrieval of information in the database and may or may not be apparent to the user.

A DSL is a combination of two languages: o A data definition language (DDL) - provides for the definition

or description of database objects

Page 3: Dbms architecture,dbms languages,data independence

o A data manipulation language (DML) - supports the manipulation or processing of database objects.

Each user sees the data in terms of an external view: Defined by an external schema, consisting basically of descriptions of each of the various types of external record in that external view, and also a definition of the mapping between the external schema and the underlying conceptual schema.

Conceptual View Level:

An abstract representation of the entire information content of the database.

It is in general a view of the data as it actually is, that is, it is a `model' of the `realworld'.

It consists of multiple occurrences of multiple types of conceptual record, defined in the conceptual schema.

To achieve data independence, the definitions of conceptual records must involve information content only.

o Storage structure is ignored o Access strategy is ignored

In addition to definitions, the conceptual schema contains authorisation and validation procedures.

Internal View Level:

The internal view is a low-level representation of the entire database consisting of multiple occurrences of multiple types of internal (stored) records.

It is however at one remove from the physical level since it does not deal in terms of physical records or blocks nor with any device specific constraints such as cylinder or track sizes. Details of mapping to physical storage is highly implementation specific and are not expressed in the three-level architecture.

The internal view described by the internal schema: o Defines the various types of stored record o What indices exist o How stored fields are represented o What physical sequence the stored records are in o In effect the internal schema is the storage structure definition.

Page 4: Dbms architecture,dbms languages,data independence

Mappings:The process to convert a request (from external level) and the result between view levels is called mapping. The mapping defines the correspondence between three view levels. The mapping description is also stored in data dictionary. The DBMS is responsible for mapping between these three types of schemas. There are two types of mapping. 

1. External-Conceptual mapping2. Conceptual-Internalmapping

The conceptual/internal mapping:

It defines conceptual and internal view correspondence specifies mapping from conceptual records to their stored counterparts

The external/conceptual mapping: It defines a particular external and conceptual view correspondence A change to the storage structure definition means that the conceptual/internal mapping must be changed accordingly, so that the

Page 5: Dbms architecture,dbms languages,data independence

conceptual schema may remain invariant, achieving physical data independence. A change to the conceptual definition means that the conceptual/external mapping must be changed accordingly, so that the external schema may remain invariant, achieving logical data independence.

DATA INDEPENDENCE:

The capacity to change the schema at one level of a database system without having to change the schema at next higher level is called data independence. Data independence is one of the main advantages of DBMS. The three-schema architecture provides the concept of data independence, which means that upper-levels are unaffected by changes to lower-levels. The three schemas architecture makes it easier to achieve true data independence. There are two kinds of data independence.

Physical data independence The ability to modify the physical scheme without causing

conceptual or application programs to be rewritten. Modifications at this level are usually to improve

performance and reorganizations of physical files.

Logical data independence The ability to modify the conceptual scheme without causing

application programs to be rewritten. Usually done when logical structure of database is altered.

Logical data independence is harder to achieve as the application programs are usually heavily dependent on the logical structure of the data. An analogy is made to abstract data types in programming languages.

Data Dictionary/Directory Systems:

The Data Dictionary/Directory System (DD/DS), consists of utilities and systems necessary to catalog, document, manage, and use metadata (data about data). Metadata include table names, attribute names, data types, physical space, relationships and so on.

Page 6: Dbms architecture,dbms languages,data independence

An example of metadata is the following definition: a six-character long alphanumeric string, for which the first character is a letter of the alphabet and each of the remaining five characters is an integer between 0 and 9; the name for the string is "employee ID" . The DD/DS utilities make use of special files that contain the database schema. (A schema, using metadata, defines the content and structure of a database.) This schema is represented by a set of tables resulting from the compilation of Data Definition Language (DDL) statements. The DD/DS is normally provided as part of a DBMS but is sometimes available from alternate sources. In current environments, data dictionaries are usually integrated with the DBMS, and directory systems are typically limited to a single platform. Network directories are used to expand the DD/DS realms. The relationship between the DD/DS and the network directory is an intricate combination of physical and logical sources of data.

DBMS Languages:

1) DDL (Data Definition Language) :It is used to specify a database scheme as a set of definitions expressed in a DDL. DDL statements are compiled, resulting in a set of tables called a data dictionary or data directory.--The data directory contains metadata (data about data)--The storage structure and access methods used by the database system are specified by a set of definitions in a special type of DDL called a data storage and definition language. Its basic idea is to hide implementation details of the database schemes from the users.

2) DML (Data Manipulation Language): A DML is a language which enables users to access and manipulate data. The goal is to provide direct human interaction with the system.

Data Manipulation is:o Retrieval of information from the databaseo insertion of new information into the databaseo deletion of information in the databaseo modification of information in the database

There are two types of DML:

Page 7: Dbms architecture,dbms languages,data independence

i) Non-Procedural-DML:A high-level or non-procedural DML allows the user to specify what data is required without specifying how it is to be obtained. Many DBMSs allow high-level DML statements either to be entered interactively from a terminal or to be embedded in a general-purpose programming language.

The end-users use a high-level query language to specify their requests to DBMS to retrieve data. Usually a single statement is given to the DBMS to retrieve or update multiple records. The DBMS translates a DML statement into a procedure that manipulates the set of records. The examples of non-procedural DMLs are SQL and QBE (Query-By-Example) that are used by relational database systems. These languages are easier to learn and use. The part of a non-procedural DML, which is related to data retrieval from database, is known as query language.

ii)Procedural-DML:A low-level or procedural DML allows the user, i.e. programmer to specify what data is needed and how to obtain it. This type of DML typically retrieves individual records from the database and processes each separately. In this language, the looping, branching etc. statements are used to retrieve and process each record from a set of records. The programmers use the low-level DML.