Database Systems Ch1: File Systems and Databases Hachim Haddouti.

26
Database Systems Ch1: File Systems and Databases Hachim Haddouti
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    220
  • download

    1

Transcript of Database Systems Ch1: File Systems and Databases Hachim Haddouti.

Page 1: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

Database Systems

Ch1: File Systems and Databases

Hachim Haddouti

Page 2: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Agenda

• Motivation

• History

• File Systems

• Database Systems

• Data models

• Summary

Page 3: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Why Database?• DBMS contains information about a particular

enterprise• DBMS provides an environment that is both convenient and efficient to use.

• Database Applications:– Banking: all transactions– Airlines: reservations, schedules– Universities: registration, grades– Sales: customers, products, purchases– Manufacturing: production, inventory, orders, supply

chain– Human resources: employee records, salaries, tax

deductions

• Databases touch all aspects of our lives

Page 4: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

History

1. File systems

2. Pre-relational Databases

3. Relational Databases

4. Post-relational Databases

Page 5: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

History (cont.)Pre-relational DB (70)

• First distinction between logical and physical data management

• Data management becomes important.

• Need of data models

Relational Database Systems (80)

• No redundancy in data storage

• Integrated data control even by distributed data storage

• Multiuser operation and high performance

Post-relational Databases (90)

• objectoriented Databases

• Multidimentional Databases

• Datawarehouses

• Distributed databases

Page 6: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

A Simple File System

Page 7: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Drawbacks of file Systems

• To retrieve data from a file system, extensive programming is often needed in a 3GL - both what and how are programmer’s responsibility

• Ad hoc queries (spur-of-the-moment questions) become impossible

• Each file must have its own file-mgt. system to create the file structure, add data to file, delete data from it, modify it and list its contents

• All data access programs are subject to change when the file structure changes (e.g., a field is deleted or its position is changed) • Structural dependency

• Even a change in the data type of a field (e.g., integer to real) requires all data access programs to change• Data dependency

Page 8: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Purpose of Database System

• In the early days, database applications were built on top of file systems

• Drawbacks of using file systems to store data:– Data redundancy and inconsistency

• Multiple file formats, duplication of information in different files

– Difficulty in accessing data • Need to write a new program to carry out each new task

– Data isolation — multiple files and formats– Integrity problems

• Integrity constraints (e.g. account balance > 0) become part of program code

• Hard to add new constraints or change existing ones

Page 9: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Purpose of Database Systems (Cont.)

• Drawbacks of using file systems (cont.) – Atomicity of updates

• Failures may leave database in an inconsistent state with partial updates carried out

• E.g. transfer of funds from one account to another should either complete or not happen at all

– Concurrent access by multiple users• Concurrent accessed needed for performance

• Uncontrolled concurrent accesses can lead to inconsistencies

– E.g. two people reading a balance and updating it at the same time

– Security problems

• Database systems offer solutions to all the above problems

Page 10: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

DBMS vs. File Systems?

• Database consists of logically related data stored in a single repository

• Provides advantages over file system management approach

– Eliminates inconsistency, data anomalies, data dependency, and structural dependency problems

– Stores data structures, relationships, and access paths

Page 11: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Levels of Abstraction

• Physical level describes how a record (e.g., customer) is stored.

• Logical level: describes data stored in database, and the relationships among the data.

type customer = recordname : string;street : string;city : integer;

end;• View level: application programs hide details of

data types. Views can also hide information (e.g., salary) for security purposes.

Page 12: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

View of Data

An architecture for a database system

Page 13: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

• Data dictionary: stores data relationships to be consulted by all programs that access the database; automatically records changes

• Structural and data dependencies are eliminated

• Interaction with the file manager: takes care of structures

for data storage

• Security: enforces data access policies

• Multi-user access control

• Backup and recovery

• Data integrity

• Data access through 4GL and 3GL’s

DBMS Functions

Page 14: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Types of Database Systems

– Number of Users• Single-user (Desktop database)

• Multi-user (Enterprise database)

– Location• Centralized• Distributed

– Use• Transactional (Production)• Decision support

• Data warehouse

Page 15: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Database ModelsDatabase Models• A database model is a collection of logical constructs used to represent the data

structure and the data relationships found within the database.

• Two Categories of Database Models

– Conceptual models focus on the logical nature of the data representation. They are concerned with what is represented rather than how it is represented.

– Implementation models place the emphasis on how the data are represented in the database or on how the data structures are implemented.

Page 16: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Database Models

• Three Types of Relationships– One-to-many relationships (1:M)

• A painter paints many different paintings, but each one of them is painted by only that painter.

– PAINTER (1) paints PAINTING (M)

– Many-to-many relationships (M:N)• An employee might learn many job skills, and each job skill might be

learned by many employees.– EMPLOYEE (M) learns SKILL (N)

– One-to-one relationships (1:1)• Each store is managed by a single employee and each store manager

(employee) only manages a single store.– EMPLOYEE (1) manages STORE (1)

Page 17: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Database ModelsDatabase Models

• Three Types of Implementation Database Models

– Hierarchical database model

– Network database model

– Relational database model

Page 18: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

A Hierarchical Structure

Page 19: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Hierarchical ModelHierarchical Model

– Advantages• Conceptual simplicity• Database security• Data independence• Database integrity• Efficiency dealing with a large database

– Disadvantages• Complex implementation• Difficult to manage• Lacks structural independence• Applications programming and use complexity• Implementation limitations• Lack of standards

Page 20: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Child with Multiple ParentsChild with Multiple Parents

Page 21: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

A Network Database Model

Page 22: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Network Database ModelNetwork Database Model

Advantages• Conceptual simplicity

• Handles more relationship types

• Data access flexibility

• Promotes database integrity

• Data independence

• Conformance to standards

Disadvantages• System complexity

• Lack of structural independence

Page 23: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Relational Database Model

– Basic Structure• RDBMS allows operations in a human logical

environment.

• The relational database is perceived as a collection of tables.

• Each table consists of a series of row/column intersections.

• Tables (or relations) are related to each other by sharing a common entity characteristic.

• The relationship type is often shown in a relational schema.

• A table yields complete data and structural independence.

Page 24: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Linking Relational Tables

Page 25: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

Relational Database ModelAdvantages

• Structural independence• Improved conceptual simplicity• Easier database design, implementation,

management, and use• Ad hoc query capability (SQL)• Powerful database management system

Disadvantages• Substantial hardware and system software

overhead• Possibility of poor design and implementation• Potential “islands of information” problems

Page 26: Database Systems Ch1: File Systems and Databases Hachim Haddouti.

DBMS, Ch1 File Systems and Databases, Hachim Haddouti

SummarySummary

– File systems

– History

– DBMS

– Data models