bab 1 - db f 3038
DESCRIPTION
Introduction to DatabaseTRANSCRIPT
![Page 1: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/1.jpg)
Introduction
DATABASE SYSTEM
![Page 2: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/2.jpg)
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
![Page 3: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/3.jpg)
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.
![Page 4: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/4.jpg)
1/5/2004TCSS545A Isabelle Bichindaritz 4
Database Management System (DBMS)
![Page 5: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/5.jpg)
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
![Page 6: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/6.jpg)
File-Based Processing
![Page 7: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/7.jpg)
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.
![Page 8: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/8.jpg)
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.
![Page 9: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/9.jpg)
Database SystemA database system is a system comprises of
database, the DBMS, and application programs, which are used by both developers
and users.
![Page 10: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/10.jpg)
Diagram 1.2 : Components of Database Systems
![Page 11: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/11.jpg)
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
![Page 12: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/12.jpg)
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.
![Page 13: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/13.jpg)
Why do we need database?
![Page 14: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/14.jpg)
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.
![Page 15: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/15.jpg)
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.
![Page 16: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/16.jpg)
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.
![Page 17: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/17.jpg)
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.
![Page 18: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/18.jpg)
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
![Page 19: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/19.jpg)
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
![Page 20: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/20.jpg)
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.
![Page 21: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/21.jpg)
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.
![Page 22: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/22.jpg)
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.
![Page 23: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/23.jpg)
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.
![Page 24: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/24.jpg)
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.
![Page 25: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/25.jpg)
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.
![Page 26: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/26.jpg)
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.
![Page 27: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/27.jpg)
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:
![Page 28: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/28.jpg)
RECORD BASED DATA MODEL
RELATIONAL
HIERARCHICALNETWORK
RECORD BASED DATA MODEL
FUNCTIONALSEMANTIC
ENTITY RELATIONSHIP
PHYSICAL BASED DATA MODEL
TYPES OF DATA MODEL
![Page 29: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/29.jpg)
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.
![Page 30: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/30.jpg)
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.
![Page 31: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/31.jpg)
HIERARCHICAL DATA MODELThe hierarchical data model transforms all
data relationships into hierarchies, or trees before they can be defined in the database.
![Page 32: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/32.jpg)
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.
![Page 33: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/33.jpg)
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.
![Page 34: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/34.jpg)
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.
![Page 35: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/35.jpg)
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.
![Page 36: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/36.jpg)
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
![Page 37: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/37.jpg)
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.
![Page 38: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/38.jpg)
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.
![Page 39: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/39.jpg)
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.
![Page 40: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/40.jpg)
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.
![Page 41: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/41.jpg)
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.
![Page 42: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/42.jpg)
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.
![Page 43: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/43.jpg)
43
ANSI-SPARC Three-Level Architecture
![Page 44: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/44.jpg)
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.
![Page 45: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/45.jpg)
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.
![Page 46: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/46.jpg)
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.
![Page 47: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/47.jpg)
47
Differences between Three Levels of ANSI-SPARC Architecture
![Page 48: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/48.jpg)
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
![Page 49: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/49.jpg)
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.
![Page 50: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/50.jpg)
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]
![Page 51: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/51.jpg)
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.
![Page 52: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/52.jpg)
Fourth Generation Language (4GL)
1. Query Languages2. Forms Generators3. Report Generators4. Graphics Generators5. Application Generators.
![Page 53: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/53.jpg)
53
Database system EnvironmentDBMS Component ModulesDatabase System UtilitiesToolsApplication EnvironmentsCommunication Facilities
![Page 54: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/54.jpg)
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
![Page 55: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/55.jpg)
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
![Page 56: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/56.jpg)
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
![Page 57: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/57.jpg)
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
![Page 58: bab 1 - db f 3038](https://reader034.vdocuments.mx/reader034/viewer/2022051400/55026f644a7959b63b8b4e50/html5/thumbnails/58.jpg)
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