1 chapter 1 introduction. 2 introduction n definition a database management system (dbms) is a...

17
1 Chapter 1 Introduction

Upload: stephen-crawford

Post on 02-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

1

Chapter 1

Introduction

2

Introduction Definition A database management system (DBMS) is a

general-purpose software system that facilitates the process of defining, constructing, and manipulating databases for various applications.

Definition A database is a collection of related data.

Definition Data are known facts that can be recorded and that have implicit meaning.

Definition File processing systems are business computer systems which store groups of records in separate files & used to process business records & produce information.

3

IntroductionDBMS File Processing Systems

- Data redundancy &inconsistency

Reduced by ensuring aphysical piece of data isavailable to all programs

Data is often duplicatedcausing higher storage andaccess cost, poor data integrity,and data inconsistency

- Accessing data Allow flexible access todata (e.g., using queriesfor data retrievals)

Allow pre-determined accessto data (i.e., complied programs); application programs aredependent on file formats

- Concurrent access Designed to coordinatemultiple users accessingthe same data at thesame time

Designed to allow a file to beaccessed by two programsconcurrently only if bothprograms have read-onlyaccess to the file

- Data security &integrity

High, enforced Loose, not enforced

4

Data Abstraction Provides an abstract view of data

Physical level: the lowest level of abstraction describes the storage structure of data.

Conceptual level: the next-higher level of abstraction describes the logical structure of the database.

View level: the highest level of abstraction describes part of the entire database. Many views are

provides for the same database.

5

Database Terminology Database Schema or Conceptual View: describes the

overall logical structure of the entire database

Database Instance: describes the content of the database

Schema = Type, Instance = Value of a variable

6

Data Independence The capacity to change the schema definition at one level

without having to change the schema definition at thenext higher level

Physical data independence: capacity to change the physical schema without having to rewrite

the application programs

Logical data independence: capacity to change the conceptual schema without having to

rewrite the application programs

logical data independence is more difficult to achieve than physical data independence

7

Data Models Describe relationships among data, data semantics, integrity, and

semantic constraints at the conceptual and view levels

I. Object-Based Logic Models DB is structured in variable-length records Provide flexible structuring capabilities Allow explicit specifications of data constraints Widely used data models: Entity-Relationship and Object-Oriented

II. Record-Based Logical Models DB is structured in fixed-format records of different types Three widely used data models: Relational, Hierarchical, and Network

II. Semi-Structured Data Model Data items of the same type can have different sets of attributes Widely used data model: XML (Extensible Markup Language)

8

Entity-Relationship (E-R) Model An object-based Model

A graphical structure (Chapter 7)

Widely used in database design

Consists of real world objects called entities and relationships among entities

An entity is an distinguishable object with a set of attributes

Entity set is a set of entities of the same type

Relationship set is a set of relationships of the same type

Mapping cardinalities represent the associations among different entities

9

An Entity-Relationship Diagram

FACULTY

STUDENT

ID#

FNAME

DEPT

ADDR

SNAME

HAS_TAKENMAJOR

ADVISES

COURSE

IS_TAKING

COURSE# CRHRS

1

n

n n

m m

An EntityAttribute

A (Binary)Relationship

Mapping Cardinalities

KeyAttribute

10

An Entity-Relationship Diagram

FACULTY

STUDENT

ID#

FNAME

DEPT

ADDR

SNAME

HAS_TAKENMAJOR

ADVISES

COURSE

IS_TAKING

COURSE# CRHRS

11

An object-based Model Object identity (object-based) vs. value identity (record-based)

A collection of objects with unique identities Objects can be simple, complex, or made up of other objects

Objects contain methods, i.e., codes operated on objects An operation/function can be performed on objects of particular classes Provide “public interface” for objects of a particular class

Classes consist of objects Correspond to abstract data type (ADT) Users can define their own classes

Only way to operate on an object by means of operators defined Message passing for accessing data in different objects

Apply a given method to a given object by sending a message

The Object-Oriented Model

12

Object-Oriented Database Systems

city

street

stNumber

Salary

Address

SSNo

EmpName

Employee

PersonName

StringRay

StringRoss

SmallInteger

11122333

HomeAddress

SmallInteger1055

String

String

SmallInteger

Alameda

Gresham

45558

first

last

Figure. An employee object.

13

The Relational Model

A record-based Model

Data are organized and stored into 2-dimensional tables (called relations)

Flexible to use and easy to understand

A relational database schema consists of a number of relation schemas of the form R(A1, A2, …, An), where R is a relation name and Ai, 1 < i < n, is an attribute name.

14

The Relational Model

Relational term Informal equivalence

Relation

Tuple

Cardinality

Attribute

Degree

Domain

Primary Key

Table

Row/Record

# of rows

Column/Field

# of columns

Set of legal values

Unique Identifier

15

The Relational Database Model

SNAME STATUS CITY

S1 Smith 2010302030

JonesBlakeClarkAdams

LondonParisParisLondonAthens

S2S3S4S5

Supplier#Supplier

LondonParisetc.

Supplier# NAMESTATUS CITY

Primary Key Cardinality

Degree

RelationTuples

Attributes

Domains

16

Data Definition Languages (DDL) & Data Manipulation Languages (DML)

DDL Declares the DB schema and compiles the schema into tables

DML Access/Manipulate (retrieve, insert, delete, & modify) the DB

• Procedural (or descriptive): specify what is needed and how to get it

• Non-procedural (or declarative): specify what is needed but not how to get it

17

Overall System Structure