--What is a Database--1 What is a database What is a Database.

Post on 19-Dec-2015

230 views 1 download

Transcript of --What is a Database--1 What is a database What is a Database.

--What is a Database-- 1

What is a database

What is a Database

--What is a Database-- 2

Basic Difinitions

Miniworld: Some part of the real world about which information is stored.

Data: Known facts about the miniworld recorded have an implicit meaning

Database (DB): A collection of related data elements Database Management System (DBMS): A software

package to facilitate the process of Defining - specifying types, organization (schema) Constructing - loading the data Manipulating - querying the data One DBMS, many DBs, many applications

Database system: A database and a DBMS

--What is a Database-- 3

A DBMS

database

application program

user

persistent storage

database

DBMS

--What is a Database-- 4

Pictorial Representation

Users/Programs

Application Programs/Queries

Software to Process Queries/Programs

Software to Access Stored Data

DATABASE SYSTEM

DBMS SOFTWARE

Stored Database Definition

(Meta-Data)

Stored Database

--What is a Database-- 5

Functions of a DBMS

Provides persistent, shared storage Objects live beyond program execution Shared by multiple applications DBMS reduces redundancy in Development and maintenance

Provides multiple interfaces Query language, embedded query language, APIs, GUIs

Protects against Software/hardware failure Security breaches

--What is a Database-- 6

When not to use a DBMS

Main costs of using a DBMS High initial investment May need additional hardware Overhead Training

When a DBMS may be unnecessary Application is simple, well-defined, and not expected to change Stringent real-time requirements (Write) access to data by multiple users is not needed

--What is a Database-- 7

Classes of DB users – Workers on the scene

Persons whose job involves daily use of a large database. Database administrators (DBAs)

Responsible for managing the database system.

Database designers End users

The people that use the database for querying, updating, generating reports

Interactive users: Use full DBMS capabilities directly via a DML. Parametric (or naive) end users: They use pre-programmed canned

transactions to interact continuously with the database. For example, bank tellers or reservation clerks.

Application programmers Design and implement canned transactions for parametric users.

--What is a Database-- 8

DBA Duties

Chooses storage structure and access strategy performance-enhancing data structures

Acts as liaison with users Security czar

Defines authorization checks and validation procedures

Responsible for backups and recovery monitoring performance and updates (to schema)

--What is a Database-- 9

Database Users – Workers Behind the Scene

People who design and develop the DBMS software DBMS designers and implementers Tool developers

Design and implement tools that facilitate the use of DBMS software. Tools include design tools, performance tools, special interfaces, etc.

Operators and maintenance personnel Run and maintain the hardware and software environment for

the database system.

--What is a Database-- 10

Interfaces

Menu vs. form-based GUI

Canned interfaces for parametric users DBA Application

Natural language Web search engines

Shell

--What is a Database-- 11

Input (Using a Form)

--What is a Database-- 12

Sample of Input Form for a Lab Work

--What is a Database-- 13

Output (Using a Report)

SID Name 1’st 2’nd 3’rd Total

8891 Allen 25% 27% 33% 85%

8767 Jones 20% 25% 0 45%

2365 Watson 13% 0 0 13%

4256 Cabeen 15% 20% 17% 52%

Exam result for ID

--What is a Database-- 14

Sample Output Report for a Lab Work

--What is a Database-- 15

Data Models

A data model is a data definition language along with a data manipulation language. Conceptual Representational Physical

--What is a Database-- 16

Data Models

A data definition language (DDL) describes database schemas. Data relationships Data semantics Integrity constraints

Database schemas vs. instances Similar to types and variables in programming languages

A data manipulation language (DML) is used for querying and updating database instances.

--What is a Database-- 17

Schema vs. Instance

Schema - Description of how data is organized and constrained.

Instance - The data in a database (conforms to a schema). Snapshot - Database state at a particular point in time. Initially empty Database is populated or loaded, DBMS ensures every state is a

valid state. Schema evolution vs. data update

--What is a Database-- 18

Type of Data Models

Record-based conceptual models (1960s) hierarchical model (e.g., IBM IMS) (1970s) network model (e.g., CA-IDMS) (1980s - current) relational model (e.g., Microsoft Access,

Microsoft SQL Server, IBM DB2, Oracle8)

Object-based conceptual models (late 1980s - current) entity-relationship model §(late 1980s - current) object-oriented model

Text-based conceptual models (late 1990s - current) XML

--What is a Database-- 19

ANSI Three-Schema Architecture

Supports DBMS characteristics of: Program-data independence. Support of multiple views of the data.

Defines DBMS schemas at three levels: Physical

How data is stored on disk Data storage structures Access paths to the data

Logical External

--What is a Database-- 20

Schema and Mappings

First Name Last Name SalaryStaffID Name Birthdate

staff_no fnamelname dob salarybranch_no

Struct STAFF { int staff_no; int branch_no; char fname [15]; char lname [15]; struct date dob; float salary; struct STAFF *next;};

index staff_no; index branch_no;

external level

physical level

conceptual level

--What is a Database-- 21

Data Independence

Each level is “independent” in the sense that a completely different organization can be used.

Physical data independence - Physical level can change without having to change the logical level.

Logical data independence - Logical level can change without having to change the external level.

--What is a Database-- 22

DBMS Achitecture

DBMS

DDL Statements

Privileged Commands

Interactive Query

Precompiler

Application Programs

Application Programmers

Host Language Compiler

Canned Transactions

DML Statements

Query Compiler

Query Execution Plan

Run-time Evaluator

Transaction and Data Manager

Data Dictionary Data Files

DDL Compiler

DBA Staff Casual UsersParametric

Users