bab 1 - db f 3038
-
Upload
syafiq-fauzi -
Category
Documents
-
view
35 -
download
2
description
Transcript of bab 1 - db f 3038
Introduction
DATABASE SYSTEM
Raw data
Acquisition
Storage
Manipulation
Retrieval
Distribution
The fundamentals of building a good database system, the following steps are required :-
Diagram 1.1 : Process of converting data into information
What is DBMS ?A database management system
(DBMS) is a collection of programs that enables users to create and maintain a database.
A software system that enables users to define, create, and maintain the database and that provides controlled access to this database.
1/5/2004TCSS545A Isabelle Bichindaritz 4
Database Management System (DBMS)
Collection of application programs that perform services for the end users (e.g. reports).
Each program defines and manages its own data.
File-Based Systems
File-Based Processing
1/5/2004TCSS545A Isabelle Bichindaritz 7
Limitations of File-Based Approach
Separation and isolation of dataEach program maintains its own set of data.Users of one program may be unaware of potentially
useful data held by other programs.
Duplication of dataSame data is held by different programs.Wasted space and potentially different values and/or
different formats for the same item.
1/5/2004TCSS545A Isabelle Bichindaritz 8
Limitations of File-Based Approach
Data dependenceFile structure is defined in the program code.
Incompatible file formatsPrograms are written in different languages, and so
cannot easily access each other’s files.
Fixed Queries/Proliferation of application programsPrograms are written to satisfy particular functions.Any new requirement needs a new program.
Database SystemA 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
Purchases from the supermarketPurchases using your credit card Booking a holiday at the travel agents Using the local library Taking out insurance Using the Internet Studying at university
Examples of Database Applications
TERMS User - A person, who adds, deletes and modifies data in the
database.
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.
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.
DBMS - A set of programs used to define, administer and process the database and its application. Example: Microsoft Access, Oracle.
Data – are facts that can be recorded and that have implicit meaning
Database is a collection of related information.
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 InformationA database stores list of information
that are related to a particular subject or purpose.
A database also makes it easy to add, update, organize and delete information.
Example: You can store business information, such as personal details of your customer, or list of customers who live in Selangor.
Find Information 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
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?For Business UseCompanies use database to store business
information.Database can help a company review,
update, and analyse information that constantly changes effectively.
Example: Staffs payrolls, customers, inventory.
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 Database System Filing System Defined and accessed
of data A single repository of data is maintained that is defined once and then is accessed by various users. Data duplication/replication
is minimized.
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 Database System Filing System
Insulation between programs and data, and data abstraction
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.
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 Database System Filing System
Controlling Data Data consistency – by controlling data redundancy, data inconsistency is
eliminated.
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 sharing-allows 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 Database System Filing System
Integrated Data All the data are centralized and integrated.
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 MODELA data model is a set of concepts that
can be used to describe the structure of a database.
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:
RECORD BASED DATA MODEL
RELATIONAL
HIERARCHICALNETWORK
RECORD BASED DATA MODEL
FUNCTIONALSEMANTIC
ENTITY RELATIONSHIP
PHYSICAL BASED DATA MODEL
TYPES OF DATA MODEL
RECORD BASED DATA MODEL
represent data by using record structures and hence are called record-based data models.
They include the three most widely used data models :-
The relational model represents the database as a collection of relations. Informally, each relation resembles a table or, to some extent, a simple file.
The hierarchical data model transforms all data relationships into hierarchies, or trees before they can be defined in the database.
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 MODELThe 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 MODELThe hierarchical data model transforms all
data relationships into hierarchies, or trees before they can be defined in the database.
NETWORK DATA MODELThe 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
The object-oriented model defines a database in terms of objects, their properties, and their operations.
The most commonly object based data models are entity relation, semantic, and functional data models.
The Object-Oriented ModelThe object-oriented model is based on a
collection of objects, like the E-R model. For example, consider an object representing a
bank account. The object contains instance variables number and
balance. The object contains a method pay-interest which
adds interest to the balance. Under most data models, changing the interest
rate entails changing code in application programs. In the object-oriented model, this only entails a
change within the pay-interest method.
The E-R Model
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. An entity is a distinguishable object that exists. Each entity has associated with it a set of attributes
describing it. E.g. number and balance for an account entity. A relationship is an association among several entities.
e.g. A cust_acct relationship associates a customer with each account he or she has.
The set of all entities or relationships of the same type is called the entity set or relationship set.
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 ModelSemantic Data ModelFeatures
More expressive data model
Directly supports conceptual data model of the enterprise
Shorter application design and programming cycle
Empowers end-users to pose complex ad hoc decision support queries
PHYSICAL BASED DATA MODEL 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 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 database’s 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 database’s 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
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.
41
Objectives of Three-Level Architecture
All users should be able to access same data.
A user’s view is immune to changes made in other views.
Users should not need to know physical database storage details.
42
Objectives of Three-Level Architecture
DBA should be able to change database storage structures without affecting the users’ views.
Internal structure of database should be unaffected by changes to physical aspects of storage.
DBA should be able to change conceptual structure of database without affecting all users.
43
ANSI-SPARC Three-Level Architecture
44
ANSI-SPARC Three-Level Architecture
External LevelUsers’ view of the database. Describes that part of database that is relevant to a
particular user.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.
45
ANSI-SPARC Three-Level Architecture
Conceptual LevelCommunity view of the database. Describes what data is stored in database and
relationships among the data. 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.
46
ANSI-SPARC Three-Level Architecture
Internal LevelPhysical representation of the database on the
computer. Describes how the data is stored in the database. 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.
47
Differences between Three Levels of ANSI-SPARC Architecture
Key FactsData are facts that can be recorded and that
have implicit 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) Allows the DBA or user to describe and name entities,
attributes, and relationships required for the application
is to specify conceptual and internal schemas for the
database and any mappings between the two.
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
Data Manipulation Languages have their functional capability 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
DML deals with data manipulation, and therefore includes most common SQL statements such SELECT, INSERT, etc.
Fourth Generation Language (4GL)
1. Query Languages2. Forms Generators3. Report Generators4. Graphics Generators5. Application Generators.
53
Database system EnvironmentDBMS Component ModulesDatabase System UtilitiesToolsApplication EnvironmentsCommunication Facilities
54
DBMS Component Modules
COMPILED (CANNED) TRANSACTIONS
PRIVILEGED COMMANDS
APPLICATION PROGRAMS
INTERACTIVE QUERY
DML STATEMENTS
Application programmers
Casual users
DDL STATEMENTS
DBA Staff
Precompiled
Host Language Compiler
Query Compiler
System Catalog/Data Dictionary
DDL Compiler
DML Compiler
Run-time Database Processor
Stored Data ManagerConcurrency Control/
Backup/Recovery Subsystems
STORED DATABASE
execution execution
Parametric users
execution
55
DBMS Component ModulesDisk access control
Stored Data ManagerOSBuffer Manager Module
CompilersDDL CompilerQuery CompilerDML CompilerPrecompiler/Host language compiler
Handling DB access at runtimeRuntime database processor
56
Database System UtilitiesLoading: load/transfer using files
Conversion toolsBackup: copy/dump databases
Failure recovery Incremental backups
File reorganization: to improve performance
Performance/access MonitoringSorting/data compression/interfacing to
network
57
ToolsCASE: Computer Aided Software
Engineering ToolsDB designers/DBA/usersDesign phase
Information repositoryData dictionary (data repository) systemsCatalog/design decisions/usage
standards/application program descriptions/user information
58
Application Development EnvironmentsE.g. PowerBuilder/JBuilderSupports
Development of database applicationsDatabase designGUI developmentQuerying and updating
Communication Software
Provide access for remote usersDB/DC packageSupports for distributed DBMSs