1 module # 8 databases module # 11 mostafa abd-el-barr modified by jehad al dallal july 2012
TRANSCRIPT
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
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
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.
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.
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.
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.
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
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
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)
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
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
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
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.
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
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.
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:
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)
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.
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.