1
Introduction to Database
Management Systems
Introduction 2
Good decisions require good information derived from raw
facts
Data is managed most efficiently when stored in a database
Databases evolved from computer file systems
Understanding file system characteristics is important
Qualities of Useful Information 3
Why Databases? 4
Databases solve many of the problems encountered in data
management.
Used in almost all modern settings involving data management:
Business
Research
Administration
Important to understand how databases work and interact
with other applications.
Data vs. Information 5
Data are raw facts
Information is the result of processing raw data to reveal meaning
Information requires context to reveal meaning
Raw data must be formatted for storage, processing, and presentation
Data are the foundation of information, which is the bedrock of
knowledge
Information used to reveal meaning in data
Accurate, relevant, timely information is the key to good decision making
Good decision making is the key to organizational survival
Data management: focuses on proper generation, storage, and retrieval
of data
Data vs. Information 6
Data vs. Information 7
Introducing the Database 8
Database: shared, integrated computer structure that stores
a collection of:
End-user data: raw facts of interest to end user
Metadata: data about data
Provides description of data characteristics and relationships in data
Complements and expands value of data
Database management system (DBMS): collection of
programs
Manages structure and controls access to data
Collection of interrelated data
Set of programs to access the data
An environment that is both convenient and efficient to use
Database Systems 9
Database system consists of logically related data stored in a
single logical data repository.
May be physically distributed among multiple storage facilities
DBMS eliminates most of file system’s problems
Current generation stores data structures, relationships between
structures, and access paths
Also defines, stores, and manages all access paths and components
Database Systems 10
The Database System Environment 11
Database system: defines and regulates the collection,
storage, management, use of data.
Five major parts of a database system:
Hardware
Software
People
Procedures
Data
The Database System Environment 12
The Database System Environment 13
Hardware: all the system’s physical devices
Software: three types of software required
Operating system software
DBMS software
Application programs and utility software
People: all users of the database system
System and database administrators
Database designers
Systems analysts and programmers
End users
Procedures: instructions and rules that govern the design and use of the
database system
Data: the collection of facts stored in the database
The Database System Environment 14
Database systems are created and managed at
different levels of complexity
Database solutions must be cost-effective as well as
tactically and strategically effective
Database technology already in use affects
selection of a database system
DBMS Functions 15
Most functions are transparent to end users
Can only be achieved through the DBMS
Data dictionary management
DBMS stores definitions of data elements and relationships
(metadata) in a data dictionary
DBMS looks up required data component structures and
relationships
Changes automatically recorded in the dictionary
DBMS provides data abstraction and removes structural
and data dependency
DBMS Functions 16
Data storage management
DBMS creates and manages complex structures required for data
storage
Also stores related data entry forms, screen definitions, report
definitions, etc.
Performance tuning: activities that make the database perform more
efficiently
DBMS stores the database in multiple physical data files
DBMS Functions 17
Data transformation and presentation
DBMS transforms data entered to conform to required data structures
DBMS transforms physically retrieved data to conform to user’s logical
expectations
Security management
DBMS creates a security system that enforces user security and data
privacy
Security rules determine which users can access the database, which
items can be accessed, etc.
DBMS Functions 18
Multiuser access control
DBMS uses sophisticated algorithms to ensure concurrent access does
not affect integrity
Backup and recovery management
DBMS provides backup and data recovery to ensure data safety and
integrity
Recovery management deals with recovery of database after a
failure
Critical to preserving database’s integrity
DBMS Functions 19
Data integrity management
DBMS promotes and enforces integrity rules
Minimizes redundancy
Maximizes consistency
Data relationships stored in data dictionary used to enforce data
integrity
Integrity is especially important in transaction-oriented database
systems
Database access languages and application programming
interfaces
DBMS provides access through a query language
Query language is a nonprocedural language
Structured Query Language (SQL) is the de facto query language
Standard supported by majority of DBMS vendors
DBMS Functions 20
Database communication interfaces
Current DBMSs accept end-user requests via multiple
different network environments
Communications accomplished in several ways:
End users generate answers to queries by filling in screen forms
through Web browser
DBMS automatically publishes predefined reports on a Web site
DBMS connects to third-party systems to distribute information via
e-mail
Database-System Applications 21
Databases are widely used. Here are some representative applications:
Enterprise Information
Sales: For customer, product, and purchase information.
Accounting: For payments, receipts, account balances, assets and other
accounting information.
Human resources: For information about employees, salaries, payroll
taxes, and benefits, and for generation of paychecks.
Manufacturing: For management of the supply chain and for tracking
production of items in factories, inventories of items in warehouses and
stores, and orders for items.
Online retailers: For sales data noted above plus online order tracking,
generation of recommendation lists, and maintenance of online product
evaluations.
Database-System Applications 22
Banking and Finance
Banking: For customer information, accounts, loans, and
banking transactions.
Credit card transactions: For purchases on credit cards and
generation of monthly statements.
Finance: For storing information about holdings, sales, and
purchases of financial instruments such as stocks and bonds;
also for storing real-time market data to enable online
trading by customers and automated trading by the firm.
Database-System Applications 23
Universities: For student information, course registrations, and
grades (in addition to standard enterprise information such as
human resources and accounting).
Airlines: For reservations and schedule information. Airlines were
among the first to use databases in a geographically distributed
manner.
Telecommunication: For keeping records of calls made, generating
monthly bills, maintaining balances on prepaid calling cards, and
storing information about the communication networks.
Databases touch all aspects of our lives
University Database Example 24
Application program examples
Add new students, instructors, and courses
Register students for courses, and generate class rosters
Assign grades to students, compute grade point averages (GPA) and
generate transcripts
In the early days, database applications were built directly on
top of file systems
Drawbacks of File Systems 25
Data redundancy and inconsistency
Multiple file formats, duplication of information in different files
Difficulty in accessing data
Need to write a new program to carry out each new task
Data isolation — multiple files and formats
Integrity problems
Integrity
constraints (e.g., account balance > 0) become “buried” in
program code rather than being stated explicitly
Hard to add new constraints or change existing ones
Drawbacks of file systems 26
Atomicity of updates
Failures
may leave database in an inconsistent state with partial
updates carried out
Example:Transfer of funds from one account to another should either
complete or not happen at all
Concurrent access by multiple users
Concurrent access needed for performance
Uncontrolled concurrent accesses can lead to inconsistencies
Example: Two people reading a balance (say 100) and updating it
by withdrawing money (say 50 each) at the same time
Security problems
Hard to provide user access to some, but not all, data
Role and Advantages of the DBMS 27
DBMS is the intermediary between the user and the database
Database structure stored as file collection
Can only access files through the DBMS
DBMS enables data to be shared
DBMS integrates many users’ views of the data
Improved data security
Better data integration
Minimized data inconsistency
Improved data access
Increased end-user productivity
28
Levels of Abstraction 29
For the system to be usable, it must retrieve data efficiently. The need for
efficiency has led designers to use complex data structures to represent data in
the database.
Physical level: describes how a record (e.g., customer) is stored.
Logical level: describes data stored in database, and the relationships
among the data.
type instructor = record
ID : string;
name : string;
dept_name : string;
salary : integer;
end;
View level: application programs hide details of data types. Views can also
hide information (such as an employee’s salary) for security purposes.
View of Data 30
An architecture for a database system
Instances and Schemas 31
Similar to types and variables in programming languages
Schema – the logical structure of the database
Example: The database consists of information about a set of customers and
accounts and the relationship between them
Analogous to type information of a variable in a program
Physical schema: database design at the physical level
Logical schema: database design at the logical level
Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
Physical Data Independence – the ability to modify the physical schema without
changing the logical schema
Applications depend on the logical 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.
Types of Databases 32
Databases can be classified according to:
Number of users
Database location(s)
Expected type and extent of use
Single-user database supports only one user at a time
Desktop database: single-user; runs on PC
Multiuser database supports multiple users at the same
time
Workgroup and enterprise databases
Types of Databases 33
Centralized database: data located at a single site
Distributed database: data distributed across
several different sites
Operational database: supports a company’s day-
to-day operations
Transactional or production database
Data warehouse: stores data used for tactical or
strategic decisions
Types of Databases 34
Unstructured data exist in their original state
Structured data result from formatting
Structure applied based on type of processing to be performed
Semistructured data have been processed to some extent
Extensible Markup Language (XML) represents data elements in
textual format
XML database supports semistructured XML data
35
Database Languages 36
A database system provides a data definition language (DDL) to
specify the database schema and a data manipulation language
(DML) to express database queries and updates. In practice, the
data-definition and data-manipulation languages are not two
separate languages; instead they simply form parts of a single
database language, such as the widely used SQL language.
Data Manipulation Language (DML) 37
Language for accessing and manipulating the data
organized by the appropriate data model
DML also known as query language
Two classes of languages
Procedural – user specifies what data is required and how to
get those data
Declarative (nonprocedural) – user specifies what data is
required without specifying how to get those data
SQL is the most widely used query language
Data Definition Language (DDL) 38
Specification notation for defining the database schema
Example: create table instructor (ID char(5), name varchar(20),
dept_name varchar(20), salary numeric(8,2))
DDL compiler generates a set of table templates stored in a data dictionary
Data dictionary contains metadata (i.e., data about data)
Database schema
Integrity constraints
Primary key (ID uniquely identifies instructors)
Referential integrity (references constraint in SQL)
e.g. dept_name value in any instructor tuple must appear in
department relation
Authorization (read authorization, insert authorization, update
authorization, delete authorization)
Structured Query Language (SQL) 39
SQL: widely used non-procedural language
Example: Find the name of the instructor with ID 22222
select name
from instructor
where instructor.ID = ‘22222’
Example: Find the ID and building of instructors in the Physics dept.
select instructor.ID, department.building
from instructor, department
where instructor.dept_name = department.dept_name and
department.dept_name = ‘Physics’
Application programs generally access databases through one of
Language extensions to allow embedded SQL
Application program interface (e.g., ODBC/JDBC) which allow SQL queries to be
sent to a database
Database Design 40
The process of designing the general structure of the database:
Logical Design– Deciding on the database schema.
Database design requires that we find a “good” collection of
relation schemas.
Business decision – What attributes should we record in the database?
Computer Science decision – What relation schemas should we have
and how should the attributes be distributed among the various
relation schemas?
Physical Design– Deciding on the physical layout of the
database
Why Database Design Is Important 41
Database design focuses on design of database
structure used for end-user data
Designer must identify database’s expected use
Well-designed database:
Facilitates data management
Generates accurate and valuable information
Poorly designed database:
Causes difficult-to-trace errors
Data Models 42
A collection of tools for describing
Data
Data relationships
Data semantics
Data constraints
Relational model
Entity-Relationship data model (mainly for database design)
Object-based data models (Object-oriented and Object-
relational)
Semistructured data model (XML)
Other older models:
Network model
Hierarchical model
Design Approaches 43
Normalization Theory
Formalize what designs are bad, and test for them
Entity Relationship Model
Models an enterprise as a collection of entities and
relationships
The Entity-Relationship Model 44
Models an enterprise as a collection of entities and relationships
Entity: a “thing” or “object” in the enterprise that is distinguishable from
other objects
Described by a set of attributes
Relationship: an association among several entities
Represented diagrammatically by an entity-relationship
diagram:
Object-Relational Data Models 45
Relational model: flat, “atomic” values
Object Relational Data Models
Extend the relational data model by including object
orientation and constructs to deal with added data
types.
Allow attributes of tuples to have complex types,
including non-atomic values such as nested relations.
Preserve relational foundations, in particular the
declarative access to data, while extending modeling
power.
Provide upward compatibility with existing relational
languages.
XML: Extensible Markup Language 46
Defined by the WWW Consortium (W3C)
Originally intended as a document markup language not a
database language
The ability to specify new tags, and to create nested tag
structures made XML a great way to exchange data, not just
documents
XML has become the basis for all new generation data
interchange formats.
A wide variety of tools is available for parsing, browsing and
querying XML documents/data
Storage Management 47
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
Efficient storing, retrieving and updating of data
Issues:
Storage access
File organization
Indexing and hashing
Query Processing 48
1. Parsing and translation
2. Optimization
3. Evaluation
Query Processing 49
Alternative ways of evaluating a given query
Equivalent expressions
Different algorithms for each operation
Cost difference between a good and a bad way of
evaluating a query can be enormous
Need to estimate the cost of operations
Depends critically on statistical information about relations
which the database must maintain
Need to estimate statistics for intermediate results to
compute cost of complex expressions
Transaction Management 50
What if the system fails?
What if more than one user is concurrently updating the same
data?
A transaction is a collection of operations that performs a
single logical function in a database application.
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.
Concurrency-control manager controls the interaction
among the concurrent transactions, to ensure the
consistency of the database.
Database Users and Administrators 51
Database
Database Users 52
Users are differentiated by the way they expect to interact with
the system
Application programmers – interact with system through DML
calls
Sophisticated users – form requests in a database query
language
Specialized users – write specialized database applications
that do not fit into the traditional data processing framework
Naïve users – invoke one of the permanent application
programs that have been written previously
Examples, people accessing database over the web, bank tellers,
clerical staff
Database Administrator 53
Coordinates all the activities of the database system
has a good understanding of the enterprise’s information
resources and needs.
Database administrator's duties include:
Storage structure and access method definition
Schema and physical organization modification
Granting users authority to access the database
Backing up data
Monitoring performance and responding to changes
Database tuning
Database System Internals
54
Database Architecture 55
The architecture of a database systems is greatly influenced by
the underlying computer system on which the database is
running:
Centralized
Client-server
Parallel (multi-processor)
Distributed
History of Database Systems 56
1950s and early 1960s:
Data processing using magnetic tapes for storage
Tapes provided only sequential access
Punched cards for input
Late 1960s and 1970s:
Hard disks allowed direct access to data
Network and hierarchical data models in widespread use
Ted Codd defines the relational data model
Would win the ACM Turing Award for this work
IBM Research begins System R prototype
UC Berkeley begins Ingres prototype
High-performance (for the era) transaction processing
History
57
1980s:
Research relational prototypes evolve into commercial systems
SQL becomes industrial standard
Parallel and distributed database systems
Object-oriented database systems
1990s:
Large decision support and data-mining applications
Large multi-terabyte data warehouses
Emergence of Web commerce
Early 2000s:
XML and XQuery standards
Automated database administration
Later 2000s:
Giant data storage systems
Google BigTable, Yahoo PNuts, Amazon, ..
Preparing for Your Database Professional Career
58
Question-Answer!! 59
60