29
1 CS 338: Computer Applications in Business: Databases (Fall 2014) ©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Some material adapted and modified from Fundamentals of Database Systems (Elmasri CS 338: Computer Applications in Business: Databases Databases and Database Users Database System Concepts & Architecture Chapter 1 (cont’d) ©1992-2014 by Addison Wesley & Pearson Education, Inc. Adapted and modified from Fundamentals of Database Systems (Elmasri et al.) Rice University Data Center Fall 2014 Chapter 2 Questions & Review 2

02 Database System Concepts

Embed Size (px)

Citation preview

Page 1: 02 Database System Concepts

1

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

CS 338: Computer Applications in Business: Databases

Databases and Database Users

Database System Concepts & Architecture

Chapter 1 (cont’d)

©1992-2014 by Addison Wesley & Pearson Education, Inc.Adapted and modified from Fundamentals of Database Systems (Elmasri et al.) Rice University Data Center

Fall 2014

Chapter 2

Questions & Review

2

Page 2: 02 Database System Concepts

2

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Review Terminologies…

A database is a collection of data

3

What is a database?What is a database?

Known facts that can be recorded and have implicit meaning

What do we mean by data?What do we mean by data?

DBMS stands for Database Management System

DBMS is a general purpose software system that facilitates theprocesses of defining, constructing, manipulating, and sharingdatabases

What is a DBMS?What is a DBMS?

Review Terminologies…

Database definition or descriptive information (stored in a database catalog)

4

What is meta-data?What is meta-data?

Structured Query Language

What does SQL stands for?What does SQL stands for?

A transaction is executing a program or process that includesone or more databases accesses (e.g. reading or updatingrecords)

What is a transaction?What is a transaction?

Â

Page 3: 02 Database System Concepts

3

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Review File Processing Approach

¾ Program-Data Dependence

¾ Duplication of Data

¾ Limited Data Sharing

¾ Lengthy Development Times

¾ Excessive Program Maintenance

5

What are some of the limitations with using the traditional file processing approach?What are some of the limitations with using the traditional file processing approach?

Â

ReviewÆ SOLUTION: DATABASE Approach

Order FilingSystem

InvoicingSystem

PayrollSystem

DBMSCentral database

Contains employee,order, inventory,

pricing, and customer data

Â

6

Page 4: 02 Database System Concepts

4

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

ReviewÆ Advantages: Database Approach

• Program-data independence• Planned data redundancy• Improved data consistency• Improved data sharing• Increased application development productivity• Enforcement of standards• Improved data quality• Improved data accessibility and responsiveness• Reduced program maintenance• Improved decision support

Â

7

Lecture Outline

Chapter 1 (cont’d)• Database Users

Chapter 2• Data Models, Schemas, and Instances• Three-Schema Architecture and Data Independence• Database Languages and Interfaces• The Database System Environment• Centralized and Client/Server Architectures for DBMSs• Classification of Database Management Systems

8

Page 5: 02 Database System Concepts

5

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Database UsersChapter 1 (cont’d)

9

Users

Database Users

Professional Users End Users

Database Designers

Database Administrators

Casual End Users

Parametric End Users

Sophisticated End users

Standalone End Users

Application ProgrammersSystem Analysts

10

Page 6: 02 Database System Concepts

6

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Users Æ Professional Users

People who are responsible developing & designing a database and its applications

Â

11

are responsible for: • Authorizing access to the database• Coordinating and monitoring its use• Acquiring software and hardware resources

Database Administrators (DBA)

are responsible for: • Identifying the data to be stored • Choosing appropriate structures to represent and store this data

Database designers

Users Æ Professional Users

People who are responsible developing & designing a database and its applications

Â

12

are responsible for: • Determining requirements of end users• Developing specifications for standard transactions

System analysts

are responsible for: • Implementing the specifications as programs• Examples: test, debug, document and maintain transactions

Application programmers

Analysts and programmers can be software developers or software engineers

Page 7: 02 Database System Concepts

7

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Users Æ End Users

People whose jobs require access to the database

Â

13

Occasionally access the database (use query language)Example: accessing bank account online

Casual end users

Constantly querying and updating the database (use standard types of queries and updates called canned transactions) Example: bank tellers, reservation agents, etc..

Naive or parametric end users

Implement their own applications to meet their complex requirements Example: engineers, scientists, business analysts, etc…

Sophisticated end users

Maintain personal databases by using ready-made programs Example: user of a tax package

Standalone users

Other UsersÆWorking Behind the Scenes

Â

14

Design and implement the DBMS modules and interfaces as a software package

DBMS system designers and implementers

Design and implement tools that facilitate database modeling and design, database system design, and improved performance

Tool developers

Responsible for running and maintaining the hardware and software environment for database system

Operators and maintenance personnel

Page 8: 02 Database System Concepts

8

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Advantages of DBMS

15

• Data normalization • Store each logical data item on only one place in the database

• Denormalization• Sometimes necessary to use controlled redundancy to improve

the performance of queries

Controlling redundancy

• Security and authorization subsystem• Privileged software (software for controlling accounts)

Restricting unauthorized access

Advantages of DBMS

16

Database systems must provide capabilities for efficiently executing queries and updates

Efficient execution

• Database systems must provide storage structures and search techniques for efficient query processing

• Three modules:• Indexes (typically based on tree or hash data structures) • Buffering and caching• Query processing and optimization

Efficient search techniques

Â

Page 9: 02 Database System Concepts

9

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Advantages of DBMS

17

• Backup and recovery subsystem of the DBMS is responsible for recovery• e.g. system fails during complex update transaction

Providing backup and recovery

• Varying levels of technical knowledge• Provide variety of graphical user interfaces (GUIs)

Providing multiple user interfaces

Â

• May include numerous varieties of data that are interrelated in many ways

• Must have capability to represent a variety of complex relationships among data

Representing complex relationships among data

Advantages of DBMS

18

• Referential integrity constraint • Every section record must be related to a course record

• Key or uniqueness constraint• Every course record must have a unique value for Course_number

• Business rules• Some rules may have to be checked by update programs or at the

time of data entry

• Inherent rules of the data model• e.g. enter Z as a student grade

Enforcing integrity constraints

Â

Page 10: 02 Database System Concepts

10

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Advantages of DBMS

19

• Deductive database systems• Provide capabilities for defining deduction rules for inferencing new

information from the stored database facts

• e.g. set some rules to determine when a student is on probation

• Trigger• Rule activated by updates to the table

• Results in updating other tables, sending messages, etc…

• Stored procedures• More involved procedures to enforce rules

Permitting inferencing and actions using rules

Â

active database systems

Advantages of DBMS

20

• Reduced application development time• Less time required compared to traditional file processing

• Flexibility• Change structure of database overtime

• Availability of up-to-date information• As soon as an update is made, it is available to all users

• Economies of scale• Consolidation of data and applications• Invest on powerful equipment rather than having each

department buy its own low performance equipment

Additional implications of using the database approach

Â

Page 11: 02 Database System Concepts

11

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

When Not to Use a DBMS

• More desirable to use regular files for:• Simple, well-defined database applications not expected to change

at all

• Stringent, real-time requirements that may not be met because of DBMS overhead

• Embedded systems with limited storage capacity

• No multiple-user access to data

21

Database System Concepts & ArchitectureChapter 2

22

Page 12: 02 Database System Concepts

12

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Data Models

• A fundamental characteristic of the database approach isachieving a level of data abstraction• Suppression of details of data organization and storage• Highlighting of the essential features for an improved

understanding of data

• Example: different users can perceive data at theirpreferred level of detail

23

A data model contains:

Data Models

Data ModelA set of concepts to describe the structure of a database, and certain constraints that the database should follow

• Specify retrievals and updates on the database• Example: insert, delete, modify, or retrieve any kind of

object

Basic operations

• Allows the database designer to specify a set of valid user-defined operations allowed on database objects

• Example: COMPUTE_GPA

Dynamic aspect or behavior

Data model helps to achieve data abstraction

Â

24

Page 13: 02 Database System Concepts

13

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Categories of Data Models

Conceptual (high-level, semantic)• Provide concepts that are close to the way many users perceive

data

Representational (Implementation) • Provide concepts that are easily understood by end users • Also similar to how data is organized on computer storage• Used by many commercial DBMS implementations (e.g.

relational data models used in many commercial systems)

Physical (low-level, internal)• Describe the details of how data is stored on computer storage

media

1

2

3

25

Categories of Data Models ÆHigh-Level or Conceptual Data

Entity• Represents a real-world object or concept (i.e. employee)• Composed of attributes

Attribute

• Represents some property of interest• Further describes an entity (i.e. employee’s name)

Relationship (among two or more entities)

• Represents an association among the entities• Usually one-to-many (1:M) or many-to-many (M:N)• Entity-Relationship model (a popular high-level conceptual model)

Uses the following concepts:

Â

26

Page 14: 02 Database System Concepts

14

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Categories of Data Models Æ Representational Data Models

Relational data model• Used most frequently in traditional commercial DBMSs • Represents a database as a collection of tables where each table

can be stored as a separate file• Uses high-level query language called SQL and support a

limited for of user views

1

Â

Object data model• Defines a database in terms of objects, their properties, and

their operations• Objects with the same structure and behavior belong to a class,

and classes are organized into hierarchies• Operations for each class are specified in terms of predefined

procedures (called methods)

2

27

Categories of Data Models Æ Representational Data Models

XML data model• Emerged as a standard for exchanging data over the Web• Uses hierarchical tree structures• It combines database concepts with concepts from document

representation models• Data is represented as elements (using tags) and data can be

nested to created complex hierarchical structures

3

Â

Network data model4

Hierarchical data model5

Old and not commonly used today

28

Page 15: 02 Database System Concepts

15

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Categories of Data Models Æ Low-Level or Physical Data Models

Access Path

• Structure that makes the search for particular database records efficient

Index

• Example of an access path • Allows direct access to data using an index term or a keyword

This data model describes how data is stored as files on a computer system

29

Schemas, Instances, and Database State

Database Schema

• The description of a database, database structure, data types, and constraints• Specified during database design and is not expected to change

frequently

Schema Diagram

• An illustrative display of database schema

In any data model, it is essential to distinguish between the description of the database and the database itself

Schema Construct

• A component of the schema or an object within the schema, e.g., STUDENT, COURSE

30

Nathan Wilson
Schema - rules for the database
Nathan Wilson
Page 16: 02 Database System Concepts

16

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Schemas, Instances, and Database StateÆ Example: Database Schema Diagram

Â

31

Schemas, Instances, and Database State

Database State or Snapshot

• The actual data in a database at a particular moment in time• Also called current set of occurrences or instances

Â

32

Page 17: 02 Database System Concepts

17

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Schemas, Instances, and Database StateÆ Example: Database State

Â

33

Schemas, Instances, and Database State

Initial State • Populated or loaded with the initial data

Valid State• Satisfies the structure and constraints specified in the schema

When we define a new database, we specify database schema to the DBMS

Â

It is very important to distinguish between database schema and database state

Schema should not change frequently

• It is common that changes occasionally need to be applied to the schema

Database state changes frequently

• The database state changes every time the database is updated34

Page 18: 02 Database System Concepts

18

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

DBMS Languages

35

DBMS Languages

Data definition language (DDL)• A language used to define database schemas• A DDL statement is used to identify description of the

schema construct and store the schema description in the DBMS catalog

In Chapter 1, we discussed database usersDBMS must provide appropriate languages and interfaces for

each category of users

36

Page 19: 02 Database System Concepts

19

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

DBMS Languages

Data manipulation language (DML)A language used to manipulate (retrieve, insert, delete, and modify) data

• Embedded Languages: DML with Java, VB, C++, etc.

Uses the following concepts:

Â

High-level or nonprocedural DML • allows user to state what data is needed rather than how it is to be

retrieved

Low-level or procedural DML

• allows user to tell system exactly how to manipulate data

1

Â

37

DBMS Languages

Storage definition language (SDL)

Specifies the internal schema

Uses the following concepts:

Â

2

View definition language (VDL)

Specifies user views/mappings to conceptual schema

3

ÂÂ

38

Page 20: 02 Database System Concepts

20

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

DBMS Interfaces

Stand-alone query language interfacesExample: Entering SQL queries at the DBMS interactive SQL interface (such as SQL*Plus in ORACLE)

1

Programmer interfaces for embedding DML in programming languages

2

User-friendly interfaces

Menu-based interfaces for Web clients or browsingForms-based interfacesGraphics-basedParametric interfaces (i.e. bank tellers using function keys)Interfaces for the DBA

3

39

Database Component Modules

DDL compiler

process schema definitions, specified in the DDL statements, and stores descriptions of the schemas in the system catalog

1

DML compiler

compiles the DML commands into object code for database access

2

Run-database processorhandles database run time access at run time. It receives retrieval and update operations and carries them out on the database

3

40

Page 21: 02 Database System Concepts

21

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Database Component Modules

Query compiler

handles high-level queries that are entered interactively

4

Data manager

controls access to DBMS information that is stored on disk through interaction with operating system

5

ÂÂÂÂ

41

42

Page 22: 02 Database System Concepts

22

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Database System Utilities

Loading utilityLoad or import existing data files into the DB

Backup utilityCreates a backup copy of the database

There are some functions that are not provided through the normalDBMS components rather they are provided through additionalprograms called utilities. Some of these are:

Database storage reorganization utilityReorganize a set of database files into different file organizations to improve performance

Performance monitoring utilityMonitors database usage and provides statistics to the DBA

43

Other Tools

CASE Tools

Used in the design phase of database systems• Examples: Rational Rose, TOAD

Other useful tools provided by the DBMS

Data dictionary (data repository) system

Stores design decisions, usage standards, application program descriptions, and user information

44

Page 23: 02 Database System Concepts

23

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Other Tools

Application development environments

Provide environment for building database applications including DB design, • GUI development, • querying and updating, and • application program development

• Examples: PowerBuilder (Sybase), JBuilder (Borland), JDeveloper 10G (Oracle)

Other useful tools provided by the DBMS

Communications softwareEnable users to connect remotely

ÂÂÂÂÂ

45

Database System Architecture

46

Page 24: 02 Database System Concepts

24

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Database System Architectures

Monolithic to Modern Systems

• From monolithic (tightly integrated) to modern systems

(modular in design)

• Has a client/server system architecture

• Similar to trends in computing

• From a large centralized mainframes to hundreds of

distributed workstations and personal computers

DBMS Architecture

47

Database System Architectures

Client / Server ArchitectureIn a basic client/server DBMS architecture, system functionality is distributed into two modules

Client module

• run on workstation of PC (i.e. GUIs)• User machine that provides user interface capabilities and local

processing

Server module

• System containing both hardware and software • Provides services to the client machines• Such as file access, printing, archiving, or database access

ÂÂ

48

Nathan Wilson
One big machine controlling everything
Nathan Wilson
Multiple machines sharing the work
Nathan Wilson
Handles multiple requests
Page 25: 02 Database System Concepts

25

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Centralized Architecture for DBMSs

Centralized DBMS Architecture

All DBMS functionality, application program execution, and user interface processing carried out on one machine

Earlier architectures used mainframe computers to provide main processing of all system functions

49

ÂCentralized Architecture for DBMSsÂ

50

Nathan Wilson
Nathan Wilson
Nathan Wilson
Nathan Wilson
Note: bad things about this design- if one machine goes down everything goes down- difficulty upgrading
Page 26: 02 Database System Concepts

26

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Basic Client/Server Architectures

Main GoalDefine specialized servers with specific functionalities

Deal with computing environments in which large number of PCs (i.e. workstations, file servers, etc…) are connected via a network

Servers with specific functionalities

Print server• Handles all print requests for one or more printers

Web servers or e-mail servers

File server• Maintains the files of the client machines

51

Basic Client/Server Architectures

Client machines

• Provide user with:• Appropriate interfaces to utilize these servers

• Local processing power to run local applications

Resources provided by these specialized servers can be accessed by client machines

ÂÂÂ

52

Nathan Wilson
Page 27: 02 Database System Concepts

27

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

ÂBasic Client/Server Architectures ÂÂ

53

Basic Client/Server Architectures

Server handles• Query and transaction functionality related to SQL processing

In the two-tier architecture, the

Client handles• User interface programs and application programs

When accessing the DBMS…

• the program establishes a connection with the DBMS (which is on the

server side)• Once established, client program then communicates with DBMS

ÂÂÂ

54

Page 28: 02 Database System Concepts

28

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

Basic Client/Server Architectures

Open Database Connectivity (ODBC) • Provides application programming interface (API)

• Allows client-side programs to call the DBMS• Both client and server machines must have the necessary software

installed

Database connectivity…

JDBC• Allows Java client programs to access one or more DBMSs through

a standard interface

ÂÂÂÂ

55

Three-Tier & n-Tier Architectures for Web Applications

Application server or Web server

• Adds intermediate layer between client and the database server

• Runs application programs and stores business rules

n-Tier Architectures…

N-tier

• Divide the layers between the user and the stored data further into

finer components

Â

56

Page 29: 02 Database System Concepts

29

CS 338: Computer Applications in Business: Databases (Fall 2014)

©1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw-Hill. Somematerial adapted and modified from Fundamentals of Database Systems (Elmasri

ÂÂÂÂÂ

57

Nathan Wilson
Advantages over two-tier:- does not overload DBMS server with application logicNote: can add in more servers as amount of data increases to add more computing power, although this adds more overhead to computing requests
Nathan Wilson
Nathan Wilson