Organizing Data Revision: pages 8-10, 31 Chapter 3.
-
Upload
mariah-kelly -
Category
Documents
-
view
215 -
download
0
Transcript of Organizing Data Revision: pages 8-10, 31 Chapter 3.
![Page 1: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/1.jpg)
Organizing Data
Revision: pages 8-10, 31
Chapter 3
![Page 2: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/2.jpg)
2
Revision:
The components of an Information System are: ___________, ____________, ___________, ______________.
To quote “a database is the heart of an Information System “, and “a comprehensive database is essential for the success of any Information System “
![Page 3: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/3.jpg)
3
![Page 4: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/4.jpg)
4
Introduction:
In any business data is accumulated. How does one store this data, so that it can be used efficiently?
Consider the following data about Invoices and Customers: see next slide
![Page 5: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/5.jpg)
5
A Table of data:
Invoice Customer Amount Payment Name Address
1110 2000 R 2000.00 Cash Nene KwaMashu
2220 3000 R 4000.00 Credit Hlela Eshowe
3330 3000 R 1500.00 Cash Hlela Eshowe
4440 9000 R 6400.00 Cash Mfeka Mtunzini
5550 9000 R 7000.00 Credit Mfeka Mtunzini
![Page 6: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/6.jpg)
6
Terminology: How manyFiles? Records? Fields?
Invoice Customer Amount Payment Name Address
1110 2000 R 2000.00 Cash Nene KwaMashu
2220 3000 R 4000.00 Credit Hlela Eshowe
3330 3000 R 1500.00 Cash Hlela Eshowe
4440 9000 R 6400.00 Cash Mfeka Mtunzini
5550 9000 R 7000.00 Credit Mfeka Mtunzini
Field
File Record
![Page 7: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/7.jpg)
7
Data Hierarchy:
A file consists of a group of related records A record is a group of related fields Now we can define a database: A database can consist of only a single file,
but usually it is a group of related files
![Page 8: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/8.jpg)
8
Slide 5:
Can you foreseen any problems with the data?
Consider the following data operations: Update, Insert, Delete
Mfeka bought more products Hlela changes address
![Page 9: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/9.jpg)
9
Can you spot the ‘mistakes’ or ANOMALIES?
Invoice Customer Amount Payment Name Address
1110 2000 R 2000.00 Cash Nene KwaMashu
2220 3000 R 4000.00 Credit Hlela Eshowe
3330 3000 R 1500.00 Cash Hlela Empangeni
4440 9000 R 6400.00 Cash Mfeka Mtunzini
5550 9000 R 7000.00 Credit Mfeka Mtunzini
6660 8000 R 5000.00 Cash Mfeca Mtunzinni
![Page 10: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/10.jpg)
10
File Queries:
What does Mfeka owes? What is the address when posting the bill to
Hlela? Is customer ‘8000’ a new customer?
![Page 11: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/11.jpg)
11
More problems:
Anomalies also exists in different files: File systems
File systems are maintained by programming code or instructions
All of this will lead to the solution: creation of a database, using a DBMS:
Database Management System See next slides:
![Page 12: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/12.jpg)
12
File Systems:
![Page 13: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/13.jpg)
13
File Contents:Customer- and Agent Files
custName custPhone agentName
Tim Buthelezi 999-55555 Sandy Ndlovu
agentName agentPhone ……………..
Sandy Ndlovu 713-4343434
![Page 14: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/14.jpg)
14
File System
![Page 15: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/15.jpg)
15
Points to take notice of:
Duplication of data leads to anomalies: Changing information in the Customer file and
NOT in the Agent file leads to inconsistency that impact on the integrity of the data.
Programmers interact DIRECTLY with the file, according to the STRUCTURE of the file. If the file organization changes, so must the
software!
![Page 16: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/16.jpg)
16
How do a DB solve these problems:
File: Duplication of data Changes to software
programs
DB: Introduces the DBMS:
Data is stored in ONLY one File
The DBMS introduces data independence:
The programmer do NOT need to know about data structures. The DBMS interact with the files
![Page 17: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/17.jpg)
17
DBMS: See page 45, Exhibit 3.2 Also pages 50, 51
![Page 18: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/18.jpg)
18
How to get rid of anomalies:
Page 48: Normalization 1NF:
Eliminate duplicated fields from the same table Create separate tables for each group of related
data Identify each record with a unique field: the
primary key
![Page 19: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/19.jpg)
19
Each table MUST represents a SINGLE subject:
Invoice Customer Amount Payment Name Address
1110 2000 R 2000.00 Cash Nene KwaMashu
2220 3000 R 4000.00 Credit Hlela Eshowe
3330 3000 R 1500.00 Cash Hlela Eshowe
4440 9000 R 6400.00 Cash Mfeka Mtunzini
5550 9000 R 7000.00 Credit Mfeka Mtunzini
![Page 20: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/20.jpg)
20
Two Tables:
CustNo CustSurname CustAddress
2000 Nene KwaMashu
3000 Hlela Eshowe
9000 Mfeka Mtunzini
InvNo InvAmount InvPayment
1110 R 2000.00 Cash
2220 R 4000.00 Credit
3330 R 1500.00 Cash
4440 R 6400.00 Cash
5550 R 7000.00 Credit
![Page 21: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/21.jpg)
21
Creation of a DB:
Create the LOGICAL view Know the tables/entities, Identify the attributes/field names,
Identify a PK for EACH table Identify the relationship between entities.
![Page 22: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/22.jpg)
22
Creation of a DB:
Logical view:
![Page 23: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/23.jpg)
23
![Page 24: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/24.jpg)
24
Relationships:
1 : 1 1 : M or M : 1 M : N
Example: A person has a passport How many subjects or tables do you identify?
![Page 25: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/25.jpg)
25
A person has a passport
![Page 26: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/26.jpg)
26
A passport belongs to a person
![Page 27: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/27.jpg)
27
![Page 28: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/28.jpg)
28
Can you determine the type of relationship?
![Page 29: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/29.jpg)
29
Example of M : N
A student registers for many courses A course is taken by many students Or: Students take many courses Note:
A relationship is bi-directional
![Page 30: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/30.jpg)
30
![Page 31: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/31.jpg)
31
Queries?
What is the phone number of customer John Smith?
Who is the customer who rented copy number 4780-3?
What is the phone number of the customer who rented ‘The Ring II’?
![Page 32: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/32.jpg)
32
Summary
We could ONLY answer the above questions because the data was well organized.
Organization starts with good database design.
Database software make it possible to handle such questions or queries.
![Page 33: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/33.jpg)
33
Implementation:
Designing Step 1: Data is in 1NF
Designing Step 2: Determine the relationship 1 : 1 1 : M M : N
![Page 34: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/34.jpg)
34
Implementation cont.
Designing Step 3: Assign data types to each field or attribute
Text Number (calculations) Date Logical Currency
![Page 35: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/35.jpg)
35
Implementation:
Design Step 4: Create a data base SCHEMA representing all the information of the previous steps.
See next slide
![Page 36: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/36.jpg)
36
Database Schema
Use MS Word
![Page 37: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/37.jpg)
37
Relational Data Model
![Page 38: Organizing Data Revision: pages 8-10, 31 Chapter 3.](https://reader035.fdocuments.in/reader035/viewer/2022062422/56649ee55503460f94bf4fc9/html5/thumbnails/38.jpg)
38
Populate:
Insert the values Put the PK of the ONE side on the MANY
side, now as a FK Answer queries:
Selection Project Join
QBE versus SQL