Uploaded by dodeca4035

1 Introduction

advertisement
CPSC 471 – Module I
Introduction
Jalal Kawash
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Required Reading
• Chapters 1 and 2 in Elmasri & Navathe, Fundamentals of Database Systems, 7th Ed.
(or earlier), Pearson
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Objectives
By the end of this module, students will be able to:
1. Describe basic DB terminology, functionality, and types of users
2. Entertain the main characteristics of the DB approach
3. Entertain the advantages of the DB approach
4. Describe what a data model is
5. Differentiate between a DB schema and set (instance)
6. Understand the three-schema architecture
7. Discuss and differentiate between centralized and distributed DB architectures
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Types of Databases and Database Applications
• Traditional Applications:
– Numeric and Textual Databases
– Focus of this course
• More Recent Applications:
– Multimedia Databases
– Geographic Information Systems (GIS)
– Biological and Genome Databases
– Data Warehouses
– Mobile databases
– Real-time and Active Databases
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Recent Developments
• Social Networks capture a lot of data
• Search Engines collect their own repository of web pages
for searching purposes
• Big Data storage systems involving large clusters of
distributed computers
• NOSQL (Not Only SQL) systems
• Cloud: huge data centers using thousands of machines
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Basic Definitions
• Database:
– A collection of related data.
• Data:
– Known facts that can be recorded and have an implicit meaning.
• Mini-world:
– Some part of the real world about which data is stored in a database.
• Database Management System (DBMS):
– A software package/ system to facilitate the creation and maintenance
of a computerized database.
• Database System:
– The DBMS software together with the data itself. Sometimes, the
applications are also included.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Simplified database system environment
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Typical DBMS Functionality
• Define a particular database in terms of its data types, structures,
and constraints
• Populate the initial database contents on a secondary storage
medium
• Manipulating the database:
– Retrieval: Querying, generating reports
– Modification: Insertions, deletions and updates to its content
• Processing and Sharing by a set of concurrent users and
application programs – yet, keeping all data valid and consistent
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Application Activities Against a Database
• Applications interact with a database by generating
– Queries: that access different parts of data and
formulate the result of a request
– Transactions: that may read some data and “update”
certain values or generate new data and store that in
the database
• Applications must not allow unauthorized users to access
data
• Applications must keep up with changing user
requirements against the database
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Additional DBMS Functionality
• DBMS may additionally provide:
– Protection or Security measures to prevent
unauthorized access
– “Active” processing to take internal actions on data
– Presentation and Visualization of data
– Maintenance of the database and associated
programs over the lifetime of the database application
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database (with a Conceptual
Data Model)
• Mini-world for the example:
– Part of a UNIVERSITY environment.
• Some mini-world entities:
– STUDENTs
– COURSEs
– SECTIONs (of COURSEs)
– (academic) DEPARTMENTs
– INSTRUCTORs
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database (with a Conceptual
Data Model)
• Some mini-world relationships:
– SECTIONs are of specific COURSEs
– STUDENTs take SECTIONs
– COURSEs have prerequisite COURSEs
– INSTRUCTORs teach SECTIONs
– COURSEs are offered by DEPARTMENTs
– STUDENTs major in DEPARTMENTs
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simple database
COURSE
Course_name
Course_number Credit_hours Department
Intro to Computer
Science
CS1310
4
CS
Data Structures
CS3320
4
CS
MATH2410
3
MATH
CS3380
3
CS
Discrete Mathematics
Database
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simple database
SECTION
Section_identifier
Course_number
Semester
Year
Instructor
85
MATH2410
Fall
07
King
92
CS1310
Fall
07
Anderson
102
CS3320
Spring
08
Knuth
112
MATH2410
Fall
08
Chang
119
CS1310
Fall
08
Anderson
135
CS3380
Fall
08
Stone
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simple database
GRADE_REPORT
Student_number
Section_identifier
Grade
17
112
B
17
119
C
8
85
A
8
92
A
8
102
B
8
135
A
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simple database
PREREQUISITE
Course_number
Prerequisite_number
CS3380
CS3320
CS3380
MATH2410
CS3320
CS1310
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Main Characteristics of the Database
Approach
1. Self-describing nature of a database system:
– DBMS catalog
– Called meta-data
– This allows the DBMS software to work with different database
applications.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simplified database catalog
RELATIONS
Relation_name
No_of_columns
STUDENT
4
COURSE
4
SECTION
5
GRADE_REPORT
3
PREREQUISITE
2
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a simplified database catalog
COLUMNS
Column_name
Data_type
Belongs_to_relation
Name
Character (30)
STUDENT
Student_number
Character (4)
STUDENT
Class
Integer (1)
STUDENT
Major
Major_type
STUDENT
Character (10)
COURSE
XXXXNNNN
COURSE
….
….
….
….
….
….
….
….
….
XXXXNNNN
PREREQUISITE
Course_name
Course_number
Prerequisite_number
Note: Major_type is defined as an enumerated type with all known majors. XXXXNNNN is
used to define a type with four alphabetic characters followed by four numeric digits.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Main Characteristics of the Database
Approach
2. Insulation between programs and data:
– Called program-data independence.
– Allows changing data structures and storage organization
without having to change the DBMS access programs.
3. Data Abstraction:
– A data model is used to hide storage details and present the
users with a conceptual view of the database.
– Programs refer to the data model constructs rather than data
storage details
4. Support of multiple views of the data:
– Each user may see a different view of the database, which
describes only the data of interest to that user.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Main Characteristics of the Database
Approach
5. Sharing of data and multi-user transaction
processing:
– Support for concurrent users.
– Concurrency control: each transaction is correctly
executed or aborted
– Recovery subsystem: ensures each completed
transaction has its effect permanently recorded in the
database
– OLTP (Online Transaction Processing): allows hundreds
of concurrent transactions to execute per second.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Database Users
• “Workers Behind the Scene”
– DBAs
– Designers
– Developers, etc …
• “Actors on the Scene”
– End users
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Advantages of Using the Database Approach
• Controlling redundancy.
– Sharing of data among multiple users.
• Restricting unauthorized access to data.
• Providing persistent storage for program Objects.
• Providing Storage Structures (e.g. indexes) for efficient
Query Processing.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Advantages of Using the Database Approach
• Providing optimization of queries for efficient processing.
• Providing backup and recovery services.
• Providing multiple interfaces to different classes of users.
• Representing complex relationships among data.
• Enforcing integrity constraints on the database.
• Drawing inferences and actions from the stored data
using deductive and active rules and triggers.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Additional Implications of Using the
Database Approach
• Potential for enforcing standards
• Reduced application development time
• Flexibility to change data structures
• Availability of current information
• Economies of scale
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Historical Development of Database
Technology
• Hierarchical and Network Models
– Mid 1960s and dominated during the seventies.
– Still in use: I B M’s I M S system.
• Relational Model based Systems
– 1970, I B M Research and several universities.
– Products emerged in the early 1980s.
• Object-oriented and emerging applications
– Late 1980s and early 1990s
– Their use has not taken off much.
– Extended relational systems add OO support and for other data types
• Data on the Web and Ecommerce
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Data Models
• Data Model:
– A set of concepts to describe the structure of a database,
the operations for manipulating these structures, and
certain constraints that the database should obey.
• Data Model Structure and Constraints:
– Constructs are used to define the database structure
– Constructs typically include elements (and their data
types) as well as groups of elements and relationships
among such groups
• Data Model Operations:
– Database retrievals and updates
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Schemas Versus Instances
• Database Schema (intension):
– The description of a database.
– Database structure, data types, and constraints.
– Infrequent changes
– Schema Construct: A component of the schema or
an object within the schema, e.g., STUDENT,
COURSE.
• Database Instance (state or extension):
– Actual stored data at a particular point in time
– Frequent changes
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database Schema
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database State
COURSE
Course_name
Course_number
Credit_hours
Department
Intro to Computer
Science
CS1310
4
CS
Data Structures
CS3320
4
CS
MATH2410
3
MATH
CS3380
3
CS
Discrete
Mathematics
Database
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database State (2 of 4)
SECTION
Section_identifier
Course_number
Semester
Year
Instructor
85
MATH2410
Fall
04
King
92
CS1310
Fall
07
Anderson
102
CS3320
Spring
05
Knuth
112
MATH2410
Fall
05
Chang
119
CS1310
Fall
05
Anderson
135
CS3380
Fall
05
Stone
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database State (3 of 4)
GRADE_REPORT
Student_number
17
17
8
8
8
8
Section_identifier
112
119
85
92
102
135
Grade
B
C
A
A
B
A
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Example of a Database State (4 of 4)
PREREQUISITE
Course_number
CS3380
CS3380
Prerequisite_number
CS3320
MATH2410
CS3320
CS1310
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
The Three-Schema Architecture
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
DBMS Languages
• Data Definition Language (DDL)
– Define the conceptual schema
• Data Manipulation Language (DML)
– Retrievals and updates
– Manipulating/querying the state
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Types of DML
• High Level or Non-procedural Language:
– “Set”-oriented and specify what data to retrieve rather
than how to retrieve it.
– Also called declarative languages.
• Low Level or Procedural Language:
– Retrieve data one record-at-a-time;
– Constructs such as looping are needed to retrieve
multiple records, along with positioning pointers.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Typical DBMS Component Modules
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Centralized and Client-Server DBMS
Architectures
• Centralized DBMS:
– Combines everything into single system
including- DBMS software, hardware,
application programs, and user interface
processing software.
– User can still connect through a remote
terminal – however, all processing is done at
centralized site.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Centralized and Client-Server DBMS
Architectures
• Centralized DBMS:
– Combines everything into single system
including- DBMS software, hardware,
application programs, and user interface
processing software.
– User can still connect through a remote
terminal – however, all processing is done at
centralized site.
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Logical Two-Tier Client Server
Architecture
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Three-Tier Client-Server Architecture
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Copyright
Adapted from Pearson’s slides for Elmasri and Navathe, Fundamentals of Database Systems, Seventh Edition
Copyright © 2016 Pearson Education, Inc.
Download