19
1 Databases Databases Module # 11 Module # 11 Mostafa Abd-El-Barr Mostafa Abd-El-Barr Modified by Modified by Jehad Al Dallal Jehad Al Dallal July 2012 July 2012

1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

Embed Size (px)

Citation preview

Page 1: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

1

Module # 8Module # 8

Databases Databases Module # 11 Module # 11

Mostafa Abd-El-Barr Mostafa Abd-El-Barr

Modified byModified byJehad Al DallalJehad Al Dallal

July 2012July 2012

Page 2: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

2

ObjectivesObjectives Introduction to Data Files

Introduction to Database Why Database? Database management

Database Management Systems (DBMS) Organization Hierarchical Network Relational Object Oriented

Types of Databases Individual Shared Distributed Proprietary

Database Use and Issues

Page 3: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

3

Data FilesData FilesData Organization

Data is organized into Groups or Categories. Each Group is more complex than the one before.

A Character is a single letter, number, or a special character.

A Field contains a set of related characters, e.g., Person’s Name on the College Registration.

A Record is a collection of related fields, e.g., Your own information on the College Registration Form.

A File is a collection of related records, e.g., all Students’ Registration information could be a file.

A Database is a collection of related files, e.g., Registration information of all colleges in a University could be a database.

Page 4: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

4

Data Files (ContData Files (Cont’’d)d) A Key Field is the particular field of a record that

is used to uniquely identifies each record. Examples: Student ID Number, Civil ID Number, Employee ID Number.

Batch Data ProcessingData is collected over a long period of time and processed all at once.Example: Bank Credit Card Bill.

Real-Time Data ProcessingData is processed at the same time the transaction occursExample: Your ATM Balance.

Page 5: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

5

Data Files (ContData Files (Cont’’d)d) Two types of files are used to update data:

master files and Transaction Files.

Master File: a complete file containing all records current up to the last update.

Example: The data file used to prepare your last month’s telephone bill.

Transaction File: Contains recent changes to records that will be used to update the master file.

Example: A temporary file that accumulates telephone charges.

Page 6: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

6

Data Files (ContData Files (Cont’’d)d)

File OrganizationThree types of file organization: Sequential, Direct, and Index Sequential file organization.

Sequential File OrganizationRecords are stored physically one after another in a predetermined order. The order is determined by the Key Field on each record, such as the student ID number.

Direct File OrganizationRecords are stored on a disk in a particular address or location that can be determined by their Key Field.

A Hashing Program is used to convert the Key Field’s numeric value to a particular storage address.

Index Sequential File organization

An index lists the Key to each group of records stored and the corresponding disk address for that group of records. Records in a file are stored sequentially.

Page 7: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

7

Data Files (ContData Files (Cont’’d)d)Type Advantages Disadvantages

Sequential Efficient access Slow access to to all or large part specific records

of records, Low cost

Direct Fast Access to specific High CostRecords

Index Faster than Sequential Not as Efficient as SequentialSequential Efficient than Direct Not as fast as Direct

High Cost

Page 8: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

8

DatabaseDatabase

Why Database?Databases are used to integrate Data. They lead to the following advantages.

• Sharing of Data.• Security of Data.• Reduced Data Redundancy.• Data Integrity: data consistency and accuracy

Page 9: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

9

Database (ContDatabase (Cont’’d)d) Database Management Systems (DBMS)Special Software used to create, modify, and access database.

DBMS consists of two main components.

(1) Data DictionaryContains the description of the structure of data used in the Database.Name of the field, data type, number of characters, etc.

(2) Query LanguageAn easy-to-use language understandable to most users.Example: Structured Query Language (SQL)

Page 10: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

10

Database (ContDatabase (Cont’’d)d)

Database Organization

Hierarchical

In this case, Fields (records) are represented as nodes in a tree. A parent-children relation exists between nodes. A parent node can have more than one child node (a one-to-many relation). A child node has only one parent node.

Drawbacks

(1) Deletion of a parent node leads to the deletion of all its children nodes.

(2) A child node can only be added if a parent node is added.

(3) No relationships exist between children nodes

Page 11: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

11

Hierarchical Database:Hierarchical Database:

Los Angeles

Chicago Cleveland New York Boston

110 139 209

Adams, S. Howell, R. McGillen, T.

departure

arrival

Flight number

passenger

Page 12: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

12

Database (ContDatabase (Cont’’d)d)

Network

A hierarchical database in which a child node may have more than one parent, i.e., a many-to-many relationship. A node can be reached through more than one path.

Advantages: More flexible and more efficient than the Hierarchical database.

Relational

Data elements are stored in tables. A table is called a relation. Rows in the table represent Records and columns represent Fields. This is the most common database for PC, e.g., Access

Advantages: Simple, easy to add and delete data

Page 13: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

13

Network Database:Network Database:

course

teacher

student

Business 101

ComputerScience 101

Mathematics101

Miller, P.Long, M.Jones, P.

Allen, D. Wayne, A.Moore, L.Hively, M.Eaton, P.

Page 14: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

14

Relational Database:Relational Database:

Address Table

NameLicense NumberStreet AddressCityStateZip

Aaron, Linda

Abar, John

FJ1987

D12372

10032 Park Lane

1349 Oak St

95874 State St

San Jose

Lakeville

Stone

CA

CA

CA

95127

94128

95201

Outstanding Citation Table

License Number

Citation Code

Violation

T25476

D98372

00031

19001

89100

Speed

Park

Speed

Abell, Jack LK3457

Owner’s TableNamePlate Number

Abrams, Sue

Abril, Pat

LMJ198

ZXA915

ABK241Abell, Jack LK3457

Key fields linked

Key fields linked

Page 15: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

15

Database (ContDatabase (Cont’’d)d)

Object-OrientedDeals with objects. These can include both data (attributes) and actions (methods) to be taken on the data, e.g. how to calculate and when to print monthly bills. OO can also include unstructured data such as Photos, Graphics, and Video.

Advantages: Flexibility.

Page 16: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

16

Employees Time cards

Trainers Front desk Managers

Photo:Last name:First name:Address:Wage rate:

Photo:Last name:First name:Address:Wage rate:

Photo:Last name:First name:Address:Yearly salary:

Wage rate XHours worked

Wage rate XHours worked

Yearly salary/52 weeks per year

ClassesClasses

ObjectsObjects

AttributesAttributes

Method toMethod to

Calculate Calculate weeklyweekly

Payroll checkPayroll check

Object-Oriented Database:Object-Oriented Database:

Page 17: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

17

Types of DatabasesTypes of Databases Individual (Microcomputer)

Collection of files used by only one person. The data and the DBMS are normally stored on the user’s HD.

Shared (Company)

This is normally a large DB stored on a mainframe and managed by a Database Administrator. Company users can have access to the DB over a network. Company DBs are the foundation for Management Information Systems (MISs)

Page 18: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

18

Types Databases (ContTypes Databases (Cont’’d)d) Distributed

Data is stored in several locations. Accessibility is made through networks.

Proprietary (Information Utilities or Databanks)

Typically a very large DB developed to cover particular needs for a specific organization.

Page 19: 1 Module # 8 Databases Module # 11 Mostafa Abd-El-Barr Modified by Jehad Al Dallal July 2012

19

Database Uses and IssuesDatabase Uses and Issues

Data WarehouseA collection of data from a variety of internal and external DBs needed to support the work of managers and business professionals.

Data MiningThis is a technique used to search Data Warehouses for related information and patterns. Database SecurityDBs may contain personal and private information about people. Therefore they have to be protected against misuse or abuse.