Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

2.1. What Is Database Management System?: Database, Contains Information Relevant To An Enterprise

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 14

C517 Database Management

Chapter 1

Introduction
2.1. What is Database Management System?
A database management system (DBMS) is a collection of interrelated data and a
set of programs to access those data. The collection of data, usually referred to a
database, contains information relevant to an enterprise.

2.2. Goals/Purposes of DBMS


The primary goal of a DBMS is to provide an environment that is both
convenient and efficient for people to use in retrieving and storing
information.
Database systems are designed to manage huge information. Management
of data involves both defining structures for storage of information and
providing mechanisms for manipulation of information.
The database system must ensure the safety and security of the information
stored, despite system crashes or attempts at unauthorized access.
The system must avoid possible abnormal results if data are to be shared
among several users.

2.3. Use of database


Where we do not use database?
Banking

For customer information, accounts, loans, banking


transactions.

Transport

For ticket reservations, schedules and routes.

Universities

For student information, courses and grades (education


management).

Credit card

For purchases on credit card, monthly statement generation

Telecommunication For keeping records of call made, generating monthly bills,


maintaining balances on prepaid calling cards, storing
information about the communication networks.
Finance

For storing information about holdings, sales, and purchases


of financial instruments such as stocks and bonds.

Sales

For customer, product and purchase information.

Page 1 of 14

C517 Database Management

Chapter 1

Manufacturing

For management of supply chains and for tracking


production of items in factories, inventories of items in
warehouses/stores and order for items.

Human resources

For information about employees, salaries, payroll taxes and


benefits and for generation of paychecks.

Internet

Access to Internet, Reservation, billing etc

2.4. Some Commercial Database Management Systems


For Medium Business and Enterprise
Oracle Oracle 8i, Oracle9i, Oracle 10g
Microsoft SQL Server
IBM DB2/DB2UDB
Informix
Sybase
MySQL
Ingress
Postgre SQL
For Home and Small Business
Microsoft Access
FoxPro
DBase

2.5. Database Systems Vs File Systems (Why DBMS?)


Database

File System
Data redundancy and inconsistency
Multiple file formats, duplication of
information in different files
2. Difficulty in accessing data
Need to write a new program to carry
out each new task

Page 2 of 14

C517 Database Management

Chapter 1

3. Data isolation
Multiple files and formats
4. Integrity problems
Integrity constraints (e.g. account
balance > 0) become part of program
code
Hard to add new constraints or change
existing ones
5. Atomicity problems
Failures may leave database in an
inconsistent state with partial updates
carried out. E.g., transfer of funds from
one account to another should either
complete or not happen at all
6. Concurrent-access anomalies
Needed for system performance and
usability
Uncontrolled concurrent accesses can
lead to inconsistencies. E.g. two people
reading a balance and updating it at the
same time
Database systems offer solutions to all 7. Security problems
these problems
Not every user of the database system
should be able to access all the data.

Page 3 of 14

C517 Database Management

Chapter 1

View of Data
A database system is a collection of interrelated files and set of programs that
allow users to access and modify these files. A major purpose of a database system
is to provide users an abstract view of the data. That is, the system hides certain
details of how the data is stored and maintained.

2.6. Data Abstraction


Several levels of data abstraction are maintained to simplify users interaction with
the system:
1. Physical level:
The lowest level of abstraction describes how data are actually stored. It
describes complex low-level data structures in detail.
2. Logical level:
The next higher level of abstraction describes what data stored in database, and
what relationships exist among those data. The logical level thus describes the
entire database in terms of a number of relatively simple structures. For
Example:
create table customer (
customer_id varchar (10),
customer_name varchar (35),
customer_street varchar (20);
salary number (10,2));
3. View level:
The highest level of abstraction describe only part of the entire database.
Computer users see a set of application programs that hide details of data
types. Several views of database are defined and users see these views. In
addition to hiding details, the views also provide a security mechanism to
prevent users from accessing certain part of the database.

Page 4 of 14

C517 Database Management

Chapter 1

2.7. Instances and Schemas


Schema: The overall design of the database is called the database schema.
Schemas are changed infrequently, if at all. This corresponds to the variable
declaration (with type definition) of a programming language. Schemas are:
1. Physical schema: Describes the database design at physical level
2. Logical schema: Describes the database design at logical level
3. View schema: Describes the database design at view level

Instances: Databases change over time as information is inserted and deleted. The
collection of information stored in the database at a particular moment is called an
instance of the database. While executing, each variable of a programming
language has a particular value at a given instant. The values of the variable in a
program at a point in time correspond to an instance of the database schema.
Physical Data Independence The ability to modify the physical schema without
changing the logical schema is called physical data independence.
- Applications depend on the logical schema (or the view schema)
- In general, the interfaces between the various levels and components should be
well defined so that changes in some parts do not seriously influence others.

2.8. Data Model

Page 5 of 14

C517 Database Management

Chapter 1

A data model is a collection of conceptual tools for describing data, data


relationship, data semantics and consistency constraints.
A. Base Models: Describes the design of the database at the logical level
1. Entity-Relationship Model: This is a higher-level data model. It is based on a
perception of a real world that consists of a collection of basic objects, called
entities and the relationship among these objects.
2. Relational Model: This is a lower level model. It uses a collection of tables to
represent both data and relationships among those data.
Each table has multiple columns, and each column has a unique name.
The relational model is the most widely used data model and a vast majority of
current database systems are based on the relational model.
The relational model is at a lower level of abstraction than the E-R model.
Database designs are often carried out in the E-R model and then translated to the
relational model.

B. Other Models:
1. Object-oriented data model: Drawing increasing attention. It can be seen as
extending of E-R model with notions of encapsulation, methods (functions) and
object identity.
2. Object-relation data model: Combines the features of object-oriented data
model and relational data model.
3. Semi-structured data model: Permits the specification of data where
individual data items of the same type may have different sets of attributes. The
extensible markup language (XML) is widely used to represent semi-structured
data.
C. Historical Models: These are in little use now:
1. Network data model
Page 6 of 14

C517 Database Management

Chapter 1

2. Hierarchical model

2.9. Database Languages:


SQL Widely used database language
Parts of SQL:
1. Data-Definition Language (DDL): A database schema is specified by a set of
definitions expressed by a special language called a data-definition language.
create table account (
account-number char(10),
balance integer)
Data storage and definition language:
- Special type of DDL language in which the storage structure and access methods
used by the database system are specified
- Usually an extension of the data definition language
The data values stored in the database must satisfy certain consistency constraints.
The DDL provides facilities to specify such constraints. The database system
checks these constraints every time the database is updated.
Data dictionary or Data Directory:
As DDL creates schema of a table it also updates a special set of tables called data
directory or data dictionary. A data dictionary contains metadata (data about data).
A database system consults the data dictionary before reading or modifying actual
data.
Relation-metadata (relation-name, no-of-attributes, storage-organization, location)
Attribute-metadata (attribute-name, relation-name, domain-type, position, length)
User-metadata (user-name, encrypted-password, group)
Index-metadata (index-name, relation-name, index-type, index-attributes)
View-metadata (view-name, definition)

Page 7 of 14

C517 Database Management

Chapter 1

2. Data-Manipulation Language (DML): DML is a language that enables users


to access or manipulate data as organized by appropriate data model. Data
manipulation includes:
i) The retrieval of information stored in the database
ii) The insertion of new information into the database
iii) The deletion of information into the database
iv) The modification of information stored in the database
Two classes of DML:
Procedural DMLs user specifies what data are required and how to get or
compute the data.
Nonprocedural DMLs (Declarative DMLs) user specifies what data are
required without specifying how to get or compute the data.
Declarative DMLs are usually easier to learn and use than procedural DMLs.
However, since a user does not have to specify how to get the data, the database
system has to figure out an efficient means of accessing data. The DML
component of SQL is nonprocedural.
Other Parts of SQL:
1. View definition
2. Transaction control
3. Embedded SQL and dynamic SQL
4. Integrity definition
5. Authority definition

Query:
A query is a statement requesting the retrieval of information. The portion of a
DML that involves information retrieval is called a query language.
General format:

Page 8 of 14

C517 Database Management

Chapter 1

select A1, A2, A3


from r1, r2, r3
where P

Example1. Find the name of the customer with customer-id 192-83-7465


select customer.customer-name
from customer
where customer.customer-id = 192-83-7465
Example2. Find the balances of all accounts held by the customer with customerid 192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = 192-83-7465 and
depositor.account-number = account.accountnumber

Page 9 of 14

C517 Database Management

Chapter 1

2.10. Database Users and Administrator


People who work with database can be categorized as database users or database
administrators.

Database Users and User Interfaces


Users are differentiated by the way they expect to interact with the system.
Different types of user interfaces have been designed for the different types of
users:
1. Naive users are unsophisticated users who interact with the system by
invoking one of the permanent application programs that have been written
previously. The typical user interface for naive user is a forms interface, where
they can fill in appropriate fields of the form.
E.g. people accessing database over the web, bank tellers, clerical staff
2. Application programmers are computer professionals who write application
programs. Application programmers can choose from many tools to develop user
interface. They can use Rapid application development (RAD) tools or different
high level programming languages.
3. Sophisticated users interact with the system without writing programs.
Instead, they form their requests in a database query language. Analysts who
submit queries to explore data in the database fall in this category.
E.g., analyst looking at sales data (OLAP Online analytical processing), data
mining
4. Specialized users are sophisticated users who write specialized database
applications that do not fit into the traditional data processing framework
E.g., computer-aided design systems, knowledge-base and expert systems and
environment-modeling systems uses complex data types (graphics data and
audio data).
Database Administrator
Page 10 of 14

C517 Database Management

Chapter 1

One of the main reasons for using DBMS is to have central control both data and
the programs that access that data. A person who has such central control over the
system is called database administrator (DBA).
To coordinate all the activities of the database system, the database administrator
has a good understanding of the enterprises information resources and needs.
The functions of Database administrator (DBA) include:
1. Schema definition: The DBA creates the original database schema by
executing a set of data definition statements in the DDL.
2. Storage structure and access method definition
3. Schema and physical-organization modification: The DBA carries out
changes to the schema and physical organization to reflect the changing needs of
the organization, or to alter the physical organization to improve the performance.
4. Granting of authorization for data access: By granting different types of
authorization, the DBA can regulate which parts of the database various users can
access.
5. Specifying integrity constraints: The DBA implements key declaration
(primary key, foreign key), trigger, assertion, business rules of the organization
6. Acting as liaison with users
7. Routine maintenance:
i) Periodically backing up the database, either onto tapes or remote servers, to
prevent loss of data in case of disasters
ii) Ensuring that enough disk space is available for normal operations and
upgrading disk space as required
iii) Monitoring jobs running on the database and ensuring better performance

2.11. Transaction Management


A transaction is a collection of operations that performs a single logical function
in a database application
Page 11 of 14

C517 Database Management

Chapter 1

_ e.g., deposit, withdrawal, transfer between accounts


ACID Properties of Transaction:
A - Atomicity
C - Consistency
I - Isolation
D - Durability
Transaction-management component ensures that the database remains in a
consistent (correct) state despite system failures (e.g., power failures and
operating system crashes) and transaction failures
_ e.g., system crash cannot wipe out committed transactions
Concurrency-control manager controls the interaction among the concurrent
transactions, to ensure the consistency of the database
_ e.g., two users accessing the same bank account cannot corrupt the system or
withdraw more than allowed

2.12. Database System Structure


A database system is portioned into modules that deal with each of the
responsibilities of the overall system. The functional components of a database
system can be broadly divided into the storage manager and the query
processor components.
The storage manager is important because databases typically require a large
amount of storage space. Data are moved between disk storage and main memory
as needed. Since the movement of data to and from disk is slow relative to the
speed of the CPU, it is imperative that the database system structure the data so as
to minimize the need to move data between disk and main memory.
The query processor is important because it helps the database system simplify
and facilitate access to data. It helps quick processing of updates and queries.

Page 12 of 14

C517 Database Management

Chapter 1

2.13. Storage Manager


A storage manager is a program module that provides the interface between the
low-level data stored in the database and the application programs and queries
submitted to the system.
The storage manager is responsible to the following tasks:
_ interaction with the file manager (OS)
_ efficient storage, retrieval and updating of data
The storage manager components include:
1. Authorization and integrity manager: tests integrity constraints and checks
the authority of users to access data.
2. Transaction manager: ensures consistency of the DB despite system failures.
3. File manager: allocation of space + data structure used to represent information
stored in the disk.
4. Buffer manager: responsible for fetching data from disk storage into main
memory, and deciding what data to cache in the main memory.
The storage manager stores:
1. Data files: which store the database itself (relations)
2. Data dictionary: stores the metadata about the structure of the database
(sometimes called catalog)
3. Indices: provide fast access to data items that hold particular values
1.8.2 The Query Processor
Components:
1. DDL interpreter: interprets DDL statements and records the definitions in the
data dictionary.

Page 13 of 14

C517 Database Management

Chapter 1

2. DML compiler: translates DML statements in a query language into an


evaluation plan consisting of low-level instructions that the query evaluation
engine understands.
3. Query evaluation engine: executes low-level instructions generated by the
DML compiler.

Page 14 of 14

You might also like