Upload
rifatmmu
View
1.538
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Lecture Notes 1
Citation preview
Chapter 1File Systems and Databases
2
Examples of Use of Database Systems
Banks
Travel Agents
Scientific Data Collection
3
Introducing the Database
• Major Database Concepts
– Data and information
•Data - Raw facts
• Information - Processed data
– Data management
– Database
– Metadata (=Data about data)
– Database management system (DBMS)
4
Introducing the Database
• Database management system (DBMS)
– DBMS is the software that interacts with the users, application programs, and the database. Example : IBM DB2, Microsoft SQL Server, Oracle, MySQL etc.
Data DBMSApplicationPrograms
5
Introducing the Database
• Importance of DBMS
– It helps make data management more efficient and effective.
– It provides end users better access to more and better-managed data.
– It promotes an integrated view of organization’s operations -- “big picture.”
– It reduces the probability of inconsistent data.
6
The DBMS Manages the Interaction Between the End User and the Database
7
• The Importance of Database Design
– A well-designed database facilitates data management and becomes a valuable information generator.
– A poorly designed database is a breeding ground for uncontrolled data redundancies.
– A poorly designed database generates errors that lead to bad decisions.
Introducing the Database
8
Basic File Terminology
Data “Raw” facts that have little meaning unlessthey have been organized in some logicalmanner.
Field A character or group of characters(alphabetic or numeric) that has a specificmeaning. A field might define a telephonenumbers, a birth date, a customer name, ayear-to-date (YTD) sales value, and so on.
Record A logically connected set of one or morefields that describes a person, place, orthing.
File A collection of related records.
Student File
Id No. Name Faculty Major1100 Ali FIT SE1200 Bobby FIT MIS1300 Clement FCM MM1400 David FCM MM1500 Evelyn FOE CE
File set of data describing all occurrences of the entity(collection of related records)
Common Data Elements
Field an individual characteristic or attribute
Recordall data aboutone occurrenceof the entity(collection of related fields)
(concept of fields, records, and files)
10
Data Model - A collection of concepts that can be used to describe the structure of database.
Database instance – Separate location of memory reserved for running a specific database
Database Schema - the description of a database, which is specified during database design and is not expected to change frequently.
Basic File Terminology
11
A Simple File System
12
File System Critique• File System Data Management
– File systems require extensive programming in a third-generation language (3GL).
– As the number of files expands, system administration becomes difficult.
– Making changes in existing file structures is important and difficult.
– Security features to safeguard data are difficult to program and usually omitted.
– Difficulty to pool data creates islands of information.
13
• Structural and Data Dependence– Structural Dependence
A change in any file’s structure requires the modification of all programs using that file.
– Data DependenceA change in any file’s data characteristics requires changes in all data access programs.
– Significance of data dependence is the difference between the data logical format and the data physical format.
File System Critique
14
• Field Definitions and Naming Conventions– A good (flexible) record definition
anticipates reporting requirements by breaking up fields into their components.
• Example:– Customer Name --> Last Name, First
Name, Initial– Customer Address --> Street
Address, City, State
File System Critique
15
• Field Definitions and Naming Conventions
– Selecting proper field names is very important.
• Names must be as descriptive as possible within restrictions.
• Naming must reflect designer’s documentation needs and user’s reporting and processing requirements.
File System Critique
16
FIELD CONTENTS
CUS_LNAME Customer last name
CUS_FNAME Customer first name
CUS_INITIAL Customer initial
CUS_AREACODE Customer area code
CUS_PHONE Customer phone
CUS_ADDRESS Customer street address or box number
CUS_CITY Customer city
CUS_STATE Customer state
File System Critique
17
• Data Redundancy:Uncontrolled data redundancy sets the stage for
– Data Inconsistency (lack of data integrity)
– Data anomalies
• Modification anomalies
• Insertion anomalies
• Deletion anomalies
File System Critique
18
• The Database System Components– Hardware
• Computer• Peripherals
– Software• Operating systems software• DBMS software• Applications programs and
utilities software
Database Systems
19
• The Database System Components– People
• Systems administrators (SA)• Database administrators (DBAs) / Owner (Dbo)• Database designers• Systems analysts and programmers• End users
– Procedures (sp)• Instructions and rules that govern the design
and use of the database system
– Data• Collection of facts stored in the database
Database Systems
20
• The Database System Components – The complexity of database systems
depends on various organizational factors:
• Organization’s size
• Organization’s function
• Organization’s corporate culture
• Organizational activities and environment
– Database solutions must be cost effective AND strategically effective.
Database Systems
21
• Types of Database Systems– Number of Users
•Single-user– Desktop database
•Multiuser– Workgroup database– Enterprise database
– Scope/limitation• Desktop• Workgroup• Enterprise
Database Systems
22
• The types of Database Systems– Location
•Centralized Database•Distributed Database
– Use•Transactional (Production)•Decision support•Data warehouse
Database Systems
23
• DBMS Functions
1.Data Dictionary Management
2.Data Storage Management
3.Data Transformation and Presentation
4.Security Management
5.Multi-User Access Control
6.Backup and Recovery Management
7.Data Integrity Management
8.Database Access Languages (DDL and DML) and Application Programming Interfaces
9.Database Communication Interfaces
Database Systems
24
• 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.
Database Models
25
• 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)
Database Models
26
• Three Types of Implementation Database Models
– Hierarchical database model
– Network database model
– Relational database model
Database Models
27
• Hierarchical Database Model
– Basic Structure
•Collection of records logically organized to conform to the upside-down tree (hierarchical) structure.
•The top layer is perceived as the parent of the segment directly beneath it.
•The segments below other segments are the children of the segment above them.
•A tree structure is represented as a hierarchical path on the computer’s storage media.
Hierarchical Database Models
Types of Database Data Models - Hierarchical
The first database systems developed were hierarchical• Databases using the hierarchical model
• use physical pointers to link records
29
Pointer Based Linkages Between
Entities
Location Prof# Name Office# 1st StudentP10 J13 Jones SB312 P203
P11 M7 Morgen BA218 P200
P12 D23 Davis SB 106 P201
Location Stud# S_nameClass Standing
Next Prof_Stud
P200 1234 Smith Fr P202P201 4678 Davis So P204P202 2943 Evans Fr P206P203 1874 Allen Jr P205P204 4017 Lloyd Fr *P205 2318 Marx Sr P207P206 6021 Keen So *P207 5503 Watts Jr *
Pointers give the physical location of a related set of data, the location values (P10, P201, etc.) in our example are meant to represent this type of physical location. Real pointers usually indicate a displacement in a file. Instead of the P203 value in the first professor record we would see an indicator that the related data begins at the 4028th byte of the file that stores student data
30
Location Prof# Name Office# 1st StudentP10 J13 Jones SB312 P203P11 M7 Morgen BA218 P200P12 D23 Davis SB 106 P201
Location Stud# S_name
Class Standing
Next Prof_Stud
P200 1234 Smith Fr P202P201 4678 Davis So P204P202 2943 Evans Fr P206P203 1874 Allen Jr P205P204 4017 Lloyd Fr *P205 2318 Marx Sr P207P206 6021 Keen So *P207 5503 Watts Jr *
Pointer Based Linkages Between Entities
Types of Database Data Models - Hierarchical
The first database systems developed were hierarchical
• Databases using the hierarchical model
• use physical pointers to link records
• allow only hierarchical relationships
32
Hierarchical
• A hierarchical relationship is one where each entity at a lower level of the hierarchy is related to only one type of entity at a higher level of the hierarchy (a higher level entity can be linked to two or more lower level “child” entities)
AA
BB CC
Types of Database Data Models - Hierarchical
The first database systems developed were hierarchical• Databases using the hierarchical model
•use physical pointers to link records•allow only hierarchical relationships+Hierarchical databases provide very efficient “high-
speed” retrieval– They are difficult to modify as an organization’s
data needs change– It is difficult to use them to represent non-
hierarchical relationships(essentially you must create multiple linked
hierarchical databases in order to represent network relationships)
34
Types of Database Data Models - Network
The next type of data model developed was the network model• Databases using the Network model
• use physical pointers to link records - like the hierarchical model
• do support network as well as hierarchical relationships+Network databases provide very efficient “high-speed”
retrieval+Can represent network, as well as, hierarchical
relationships easily– Are difficult to modify as an organization’s data needs
change– Have complex pointer structures which can be difficult
to manipulate and hard for end-users to understand.
35
• A network relationship is one in which an entity at a lower level can be linked to two or more entities at a higher level. – E.G. - an order is related to
both a customer who placed it and a salesperson who made the sale
• The hierarchical model does not support network relationships.– To capture them a second
database would have to be created and linked to the first.
Network Relationships
AA
BBCC
36
Types of Database Data Models - Relational
• 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.
37
Repetition of Identifying Data to Link Related Data
Prof# Name Office#J13 Jones SB312M7 Morgen BA218D23 Davis SB 106
Stud# S_nameClass Standing Prof#
1234 Smith Fr M74678 Davis So D232943 Evans Fr M71874 Allen Jr J134017 Lloyd Fr D232318 Marx Sr J136021 Keen So M75503 Watts Jr J13
38
Linking Relational Tables
39
Relational Database Model
- Advantages• 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
40
A Relational Schema
41
• Entity-Relationship Data Model
– It is one of the most widely accepted graphical data modeling tools.
– It graphically represents data as entities and their relationships in a database structure.
– It complements the relational data model concepts.
Entity-Relationship Data Model
42
• Entity Relationship Data Model– Basic Structure
•E-R models are normally represented in an entity relationship diagram (ERD).
•An entity is represented by a rectangle.
•Each entity is described by a set of attributes. An attribute describes a particular characteristics of the entity.
•A relationship is represented by a diamond connected to the related entities.
Entity-Relationship Data Model
43
The ER Diagram
Complements the relational data model concepts Represented in an entity relationship diagram (ERD) Based on entities, attributes, and relationships
44
• Entity-Relationship Data Model– Advantages
• Exceptional conceptual simplicity
• Visual representation
• Effective communication tool
• Integrated with the relational database model
– Disadvantages
• Limited constraint representation
• Limited relationship representation
• No data manipulation language
• Loss of information content
Entity-Relationship Data Model
45
Types of Database Data Models - Object Oriented
• Object-Oriented Database Model
– Basic Structure
• Objects are abstractions of real-world entities or events.
• Attributes describe the properties of an object.
• Objects that share similar characteristics are grouped in classes.
• A class is a collection of similar objects with shared structure (attributes) and behavior (methods).
• Classes are organized in a class hierarchy.
• An object can inherit the attributes and methods of the classes above it.
46
• Object-Oriented Database Model– Characteristics
•An object is described by its factual content.
•An object includes information about relationships between the facts within the object, as well as with other objects.
•An object is a self-contained building block for autonomous structures.
Types of Database Data Models - Object Oriented
47
• Object-Oriented Database Model
– Advantages
• Add semantic content
• Visual presentation includes semantic content
• Database integrity
• Both structural and data independence
– Disadvantages
• Lack of OODM standards
• Complex navigational data access
• Steep learning curve
• High system overhead slows transactions
Types of Database Data Models - Object Oriented
48
A Comparison: The OO Data Model andthe ER Model
49
Centralized Versus Decentralized Database Systems
• Centralized Database with remote Access– All processing to support the database
system is performed on a central computer. Only input/output functions are performed remotely. (If PCs are used for remote access
they operate in terminal emulation mode and do not perform processing)
Centralized Database with Remote Access
TerminalOnly I/O
done here
TerminalOnly I/O
done here
TerminalOnly I/O
done here
TerminalOnly I/O
done hereCentral DBComputer
All processing related to DBSystem done
here
51
• Centralized Database with remote Access– All processing to support the database system
is performed on a central computer. Only input/output functions are performed remotely.
• Client-Server Database– All data reside on a central server– Core database management processing is
performed on server– Application files and processing to request data,
manipulate results and manage the user interface is performed on client computers
Centralized Versus Decentralized Database Systems
Client-Server Database System
Server ComputerAll Database
access, retrievaland, manipula-tion processesperformed here
Client Comp
Syntax checksof SQL stmts.Manipulation- presentationof retrieved
data done here
Client Comp
Syntax checksof SQL stmts.Manipulation- presentationof retrieved
data done here
53
References
ROB, P. AND CORONEL, C., 2004, Database Systems. 6th Ed., Thomson Course Technology