Top Banner
CS311 Database Management system Somchai Thangsathityangkul 1
30

CS311 Database Management system Somchai Thangsathityangkul 1.

Jan 19, 2016

Download

Documents

Letitia Reed
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS311 Database Management system Somchai Thangsathityangkul 1.

CS311 Database Management system

Somchai Thangsathityangkul

1

Page 2: CS311 Database Management system Somchai Thangsathityangkul 1.

Database Systems

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

2

Page 3: CS311 Database Management system Somchai Thangsathityangkul 1.

3

Page 4: CS311 Database Management system Somchai Thangsathityangkul 1.

The Database System Environment

Five major parts of a database system: Hardware Software People Procedures Data

4

Page 5: CS311 Database Management system Somchai Thangsathityangkul 1.

5

Page 6: CS311 Database Management system Somchai Thangsathityangkul 1.

The Database System Environment (cont'd.)

Hardware: all the system’s physical devices

Software: three types of software required: Operating system software DBMS software Application programs and utility

software

6

Page 7: CS311 Database Management system Somchai Thangsathityangkul 1.

The Database System Environment (cont'd.)

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

7

Page 8: CS311 Database Management system Somchai Thangsathityangkul 1.

Data Models

Data models Relatively simple

representations of complex real-world data structures Often graphical

8

Page 9: CS311 Database Management system Somchai Thangsathityangkul 1.

Data Model Basic Building Blocks

Entity: anything about which data are to be collected and stored

Attribute: a characteristic of an entity Relationship: describes an association

among entities One-to-many (1:M) relationship

Many-to-many (M:N or M:M) relationship

One-to-one (1:1) relationship

Constraint: a restriction placed on the data

9

Page 10: CS311 Database Management system Somchai Thangsathityangkul 1.

One to One Relationship

10

Page 11: CS311 Database Management system Somchai Thangsathityangkul 1.

One to Many Many to Many

11

Page 12: CS311 Database Management system Somchai Thangsathityangkul 1.

Business Rules

Descriptions of policies, procedures, or principles within a specific organization Apply to any organization that stores and uses

data to generate information

Description of operations to create/enforce actions within an organization’s environment Must be in writing and kept up to date

Must be easy to understand and widely disseminated

Describe characteristics of data as viewed by the company

12

Page 13: CS311 Database Management system Somchai Thangsathityangkul 1.

The Relational Model

Developed by E.F. Codd (IBM) in 1970 Table (relations)

Matrix consisting of row/column intersections

Each row in a relation is called a tuple

Relational models were considered impractical in 1970

Model was conceptually simple at expense of computer overhead

13

Page 14: CS311 Database Management system Somchai Thangsathityangkul 1.

The Relational Model (cont’d.)

Relational diagram Representation of entities,

attributes, and relationships

Relational table stores collection of related entities

14

Page 15: CS311 Database Management system Somchai Thangsathityangkul 1.

15 The Relational Model

Page 16: CS311 Database Management system Somchai Thangsathityangkul 1.

The Entity Relationship Model

Widely accepted standard for data modeling

Introduced by Chen in 1976 Graphical representation of entities and

their relationships in a database structure

Entity relationship diagram (ERD) Uses graphic representations to model

database components Entity is mapped to a relational table

16

Page 17: CS311 Database Management system Somchai Thangsathityangkul 1.

The Entity Relationship Model (cont’d.)

Entity instance (or occurrence) is row in table Entity set is collection of like entities Connectivity labels types of relationships Relationships are expressed using Chen

notation Relationships are represented by a diamond

Relationship name is written inside the diamond

17

Page 18: CS311 Database Management system Somchai Thangsathityangkul 1.

Entities and Instances

PERSON

PRODUCT

PRODUCT TYPE

EMPLOYMENT CONTRACT

JOB

SKILL LEVEL

TICKET RESERVATION

PURCHASE

ELECTION

PRINTER PREFERENCE

DOCUMENT VERSION

Mahatma Gandhi2.5 x 35 mm copper nailnailmy previous contractviolinistfluenttonight: Hamlet in the Royalthe CD I bought yesterdayfor parliament next fall…...

18

Page 19: CS311 Database Management system Somchai Thangsathityangkul 1.

Entities and Sets

An entity represents a set of instances that are of interest to a particular business.

dish washer

waiter

cookwaitress

manager

financial controller

porter

piano player

19

Page 20: CS311 Database Management system Somchai Thangsathityangkul 1.

Relationship

JOB

waiter

cook

waitress

manager

financial controller

porter

piano player

Ahmed

JillAdam

Maria

EMPLOYEE

Shintarodish washer

20

Page 21: CS311 Database Management system Somchai Thangsathityangkul 1.

The Entity Relationship Model21

Page 22: CS311 Database Management system Somchai Thangsathityangkul 1.

Degrees of Data Abstraction

Database designer starts with abstracted view, then adds details

ANSI Standards Planning and Requirements Committee (SPARC) Defined a framework for data modeling

based on degrees of data abstraction (1970s): External

Conceptual

Internal

22

Page 23: CS311 Database Management system Somchai Thangsathityangkul 1.

Degrees of Data Abstraction23

Page 24: CS311 Database Management system Somchai Thangsathityangkul 1.

The External Model

End users’ view of the data environment

ER diagrams represent external views External schema: specific

representation of an external view Entities Relationships

24

Page 25: CS311 Database Management system Somchai Thangsathityangkul 1.

25

Page 26: CS311 Database Management system Somchai Thangsathityangkul 1.

The Conceptual Model

Represents global view of the entire database

All external views integrated into single global view: conceptual schema

ER model most widely used ERD graphically represents the

conceptual schema

26

Page 27: CS311 Database Management system Somchai Thangsathityangkul 1.

The Conceptual Model27

Page 28: CS311 Database Management system Somchai Thangsathityangkul 1.

The Internal Model

Representation of the database as “seen” by the DBMS Maps the conceptual model to the DBMS

Internal schema depicts a specific representation of an internal model

Depends on specific database software Change in DBMS software requires internal

model be changed

Logical independence: change internal model without affecting conceptual model

28

Page 29: CS311 Database Management system Somchai Thangsathityangkul 1.

The Internal Model29

Page 30: CS311 Database Management system Somchai Thangsathityangkul 1.

The Physical Model

Operates at lowest level of abstraction Describes the way data are saved on storage

media such as disks or tapes

Requires the definition of physical storage and data access methods

Relational model aimed at logical level Does not require physical-level details

Physical independence: changes in physical model do not affect internal model

30