Anda di halaman 1dari 58

DATABASE SYSTEM

Introduction

The fundamentals of building a good database system, the following steps are required :-

Raw data

Acquisition

Storage

Manipulation

Retrieval

Distribution

Diagram 1.1 : Process of converting data into information

What is DBMS ?
y A database management system (DBMS) is a collection of

programs that enables users to create and maintain a database.


y A software system that enables users to define,

create, and maintain the database and that provides controlled access to this database.

Database Management System (DBMS)

TCSS545A Isabelle Bichindaritz

1/5/2004

File-Based Systems
y Collection of application programs that perform

services for the end users (e.g. reports).


y Each program defines and manages its own data.

File-Based Processing

Limitations of File-Based Approach


y Separation and isolation of data
y Each program maintains its own set of data. y Users of one program may be unaware of potentially

useful data held by other programs.


y Duplication of data
y Same data is held by different programs. y Wasted space and potentially different values and/or

different formats for the same item.

TCSS545A Isabelle Bichindaritz

1/5/2004

Limitations of File-Based Approach


Data dependence
y File structure is defined in the program code.

Incompatible file formats


y Programs are written in different languages, and so

cannot easily access each others files.

Fixed Queries/Proliferation of application

programs

y Programs are written to satisfy particular functions. y Any new requirement needs a new program.

TCSS545A Isabelle Bichindaritz

1/5/2004

Database System
y A database system is a system comprises of database, the

DBMS, and application programs, which are used by both developers and users.

Diagram 1.2 : Components of Database Systems

Examples of Database Applications


y Purchases from the supermarket y Purchases using your credit card y Booking a holiday at the travel agents y Using the local library y Taking out insurance y Using the Internet y Studying at university

TERMS
y User - A person, who adds, deletes and modifies data in the database. y Application - A business computer system that processes a portion of the database to meet user

information needs. It consists of menus, forms, reports, queries and application programs. y Application Programs - A custom developed program for processing a database. It can be written in a standard procedural language such as COBOL, C, or BASIC or in a language unique to the DBMS. Example: Book Information System.
y DBMS - A set of programs used to define, administer and process the database

and its application. Example: Microsoft Access, Oracle.


y Data are facts that can be recorded and that have implicit meaning y Database is a collection of related information. y Database system a system comprises of database, the DBMS and application programs, which are

used by both developers and users.

Why do we need database?

Store Information
y A database stores list of information that are related to a

particular subject or purpose. y A database also makes it easy to add, update, organize and delete information. y Example:You can store business information, such as personal details of your customer, or list of customers who live in Selangor.

Find Information
y y

You can easily and instantly locate information stored in a database. Example:You can find all the customers with the last name John or all customer where their income is below RM 2000 and are older than 35.

Analyse and Print Information


y y y

Calculations on the information can be performed in a database to help you make quick and accurate decisions. Information is presented in professionally designed reports. Example:You can calculate the percentage of the sales that you make for every month.

Where database can be used?


y For Business Use y Companies use database to store business information. y Database can help a company review, update, and analyse

information that constantly changes effectively. y Example: Staffs payrolls, customers, inventory.

y For Personal Use

-Many people use database to store personal information. -Information is easier to store and organise compared to using sheets of paper. -Example: Addresses and recipes

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Defined and accessed of data Database System A single repository of data is maintained that is defined once and then is accessed by various users. Data duplication/replication is minimized. Filing System Each user defines and implements the files needed for a specific application. Uncontrolled data redundancy each application (or department) has its own data. If another application or department needed similar data, the data had to be re-entered all over again

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Insulation between programs and data, and data abstraction Database System The detailed structure and organization of each file are stored in the catalog. Access programs are written independently of any specific files and the structure of data files is stored separately from the access programs. Filing System The structure is embedded in the access programs, so any changes to the structure of a file may require changing all programs that access this file.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Controlling Data Database System Data consistency by controlling data redundancy, data inconsistency is eliminated. Filing System Data inconsistency When the same data is stored in multiple files, data inconsistency is inevitable.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Database System Filing System

Data Sharing

Unlimited data sharingallows users from different departments to share the corporate data according to their information needs.

Limited data sharing difficult to share data when different applications create their own data files.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Integrated Data Database System All the data are centralized and integrated. Filing System All the data are not centralized and unintegrated.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Database System Filing System

Data Dependence

The code and data descriptions (or file structures) are separated. The data descriptions can change without having to change the code that operates on the data.

To change the file structure, you also have to code, test and document your program all over again.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Database System Filing System

Data Security

As the database is centralized, it is relatively easy to protect the data against all kinds of threats whether accidental or intentional.

As the database is decentralized, it is not enough to have tight security in one department but no security in another department.

COMPARISON BETWEEN DATABASE SYSTEM AND FILING SYSTEM


Characteristics Database System Filing System

Program Maintenance errors, enhancements, coding, testing and etc.)

Reduced program maintenance is made easy in the database approach.

Excessive program maintenance All information systems need to be maintained.

DATA MODEL
y A data model is a set of concepts that can be used to describe the

structure of a database. y It is the process of creating representation of the users` view of the data. If the data model incorrectly represents the users` view of the data, they will find the applications difficult to use, incomplete, and very frustrating. Below are types of data model:

TYPES OF DATA MODEL


HIERARCHICAL FUNCTIONAL
RECORD BASED DATA MODEL RECORD BASED DATA MODEL

NETWORK

SEMANTIC

RELATIONAL ENTITY RELATIONSHIP


PHYSICAL BASED DATA MODEL

RECORD BASED DATA MODEL


y represent data by using record structures and hence are called

record-based data models. y They include the three most widely used data models :y The relational model represents the database as a

collection of relations. Informally, each relation resembles a table or, to some extent, a simple file. y The hierarchical data model transforms all data relationships into hierarchies, or trees before they can be defined in the database. y The network data model represents data as record types and also represents a limited type of one-to-many relationships called a set type.

RELATIONAL MODEL
y The relational model

represents the database as a collection of relations. Informally, each relation resembles a table or, to some extent, a simple file.

HIERARCHICAL DATA MODEL


y The hierarchical data model transforms all data relationships

into hierarchies, or trees before they can be defined in the database.

NETWORK DATA MODEL


y The network data model represents data as record types

and also represents a limited type of one-to-many relationships called a set type.

OBJECT BASED DATA MODEL


y The object-oriented model defines a database in terms of

objects, their properties, and their operations. y The most commonly object based data models are entity relation, semantic, and functional data models.

The Object-Oriented Model


y The object-oriented model is based on a collection of objects,

like the E-R model. y For example, consider an object representing a bank account.
y The object contains instance variables number and balance. y The object contains a method pay-interest which adds interest to the

balance. y Under most data models, changing the interest rate entails changing code in application programs. y In the object-oriented model, this only entails a change within the pay-interest method.

The E-R Model


y The entity-relationship model is based on a perception of the world as

consisting of a collection of basic objects (entities) and relationships among these objects.
y An entity is a distinguishable object that exists. y Each entity has associated with it a set of attributes describing it. y E.g. number and balance for an account entity. y A relationship is an association among several entities. y e.g. A cust_acct relationship associates a customer with each account he or she has. y The set of all entities or relationships of the same type is called the entity

set or relationship set. y Another essential element of the E-R diagram is the mapping cardinalities, which express the number of entities to which another entity can be associated via a relationship set.

Semantic Data Model


Features
y More expressive data model y Directly supports conceptual data model of the enterprise y Shorter application design and programming cycle y Empowers end-users to pose complex ad hoc decision support

queries

PHYSICAL BASED DATA MODEL


y

Physical based data model describes how data is stored in the computer by representing information such as record formats, record orderings, and access paths. It is the process of choosing specific storage structures and access paths for the database files to achieve good performance for the various database applications.

DATA MODEL SCHEMA AND INSTANCE


y y y y y

The description of database is called the database schema. A database schema is specified during database design and is not executed to change frequently. It defines a databases structure, its tables, relationships, domains, and business rules. A database schema is a design, the foundation on which the database and the application are built. The data in a database at a particular moment in time is called a database instance.

DATA MODEL SCHEMA


The description of database is called the database

schema.
A database schema is specified during database design and is

not executed to change frequently.


It defines a databases structure, its tables, relationships,

domains, and business rules.


A database schema is a design, the foundation on which the

database and the application are built.

DATA MODEL INSTANCE


y The data in a database at a particular moment in

time is called a database instance (or a set of occurrences). In a given database instance, each schema construct has each on current set of instances.

Objectives of Three-Level Architecture


y All users should be able to access same data. y A users view is immune to changes made in other

views.
y Users should not need to know physical database

storage details.

41

Objectives of Three-Level Architecture


y DBA should be able to change database storage

structures without affecting the users views. by changes to physical aspects of storage. of database without affecting all users.

y Internal structure of database should be unaffected

y DBA should be able to change conceptual structure

42

ANSI-SPARC Three-Level Architecture

43

ANSI-SPARC Three-Level Architecture


y External Level y Users view of the database. y Describes that part of database that is relevant to a particular user. y 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. A high-level data model or an implementation data model can be used at this level.

44

ANSI-SPARC Three-Level Architecture


y Conceptual Level y Community view of the database. y Describes what data is stored in database and relationships among the data. y 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. A high-level data model or an implementation data model can be used at this level.
45

ANSI-SPARC Three-Level Architecture


y Internal Level
y Physical representation of the database on the

computer. y Describes how the data is stored in the database. y 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.

46

Differences between Three Levels of ANSISPARC Architecture

47

Key Facts
y Data are facts that can be recorded and that have implicit y y y

y y

meaning. A database is a collection of related data. A database management system (DBMS) is a collection of programs that enables users to create and maintain a database. A database system is a system comprises of database, the DBMS, and application programs, which are used by both developers and users. Database schema is the description of database A database instance is the data in a database at a particular moment

Database Language
Data definition language (DDL)
y Allows the DBA or user to describe and name entities, attributes,

and relationships required for the application


y is to specify conceptual and internal schemas for the database

and any mappings between the two.


y Data Definition Language deals with database schemas and

descriptions of how the data should reside in the database, therefore language statements like CREATE TABLE or ALTER TABLE belong to DDL.

Data Manipulation Language (DML)


Data Manipulation Language (DML) is a family of computer

languages used by computer programs and/or database users to insert, delete and update data in a database. Typical manipulation include retrieval, insertion, deletion, and modification of the data. Read-only querying, i.e. SELECT, of this data may be considered to be either part of DML or outside it, depending on the context. Currently the most popular data manipulation language is that of SQL, which is used to retrieve and manipulate data in a Relational database.[1]

Data Manipulation Languages


DML deals with data manipulation, and therefore includes most common SQL statements such SELECT, INSERT, etc.

y Data Manipulation Languages have their functional capability

y y y y y

organized by the initial word in a statement, which is almost always a verb. In the case of SQL, these verbs are: SELECT ... INTO INSERT UPDATE DELETE The SELECT ... INTO form is considered to be DML because it manipulates (i.e. modifies) data

Fourth Generation Language (4GL)

1. 2. 3. 4. 5.

Query Languages Forms Generators Report Generators Graphics Generators Application Generators.

Database system Environment


 DBMS Component Modules  Database System Utilities  Tools  Application Environments  Communication Facilities

53

DBMS Component Modules

54

DBMS Component Modules


 Disk access control  Stored Data Manager  OS  Buffer Manager Module  Compilers  DDL Compiler  Query Compiler  DML Compiler  Precompiler/Host language compiler  Handling DB access at runtime  Runtime database processor

55

Database System Utilities


 Loading: load/transfer using files
 Conversion tools

 Backup: copy/dump databases


 Failure recovery  Incremental backups

 File reorganization: to improve performance  Performance/access Monitoring  Sorting/data compression/interfacing to network

56

Tools
 CASE: Computer Aided Software Engineering Tools
 DB designers/DBA/users  Design phase

 Information repository
 Data dictionary (data repository) systems  Catalog/design decisions/usage standards/application program

descriptions/user information

57

Application Development Environments


 E.g. PowerBuilder/JBuilder  Supports
 Development of database applications  Database design  GUI development  Querying and updating

Communication Software
 Provide access for remote users  DB/DC package  Supports for distributed DBMSs
58

Anda mungkin juga menyukai