2.1 Data Input and Sources of Error Data Input Can be done through: Keyboards Sensors Scanners Sound...
-
Upload
prosper-bryant -
Category
Documents
-
view
227 -
download
0
Transcript of 2.1 Data Input and Sources of Error Data Input Can be done through: Keyboards Sensors Scanners Sound...
2.1 Data Input and Sources of Error
Data Input Can be done through:
Keyboards Sensors Scanners Sound recorders Digital video cameras
2.1 Data Input and Sources of Error
Sources of Error Mistakes may be made during data entry. Three different sources of errors caused by manual
input:Error Source of error Example
Data source error Data source providers provide incorrect data.
An interviewee reports an incorrect telephone number.
Transcription error
Data is read or typed in incorrectly. ‘ 1’ as ‘l’ or ‘o’ as ‘0’
Transposition error
Two consecutive digits are swapped.
Type 61 when you intend to type 16.
Sources of error caused by manual input
2.1 Data Input and Sources of Error
Garbage-in-garbage-out (GIGO) Erroneous data always produces inaccurate information. Waste human resources while producing useless
information. Steps must be taken to identify inaccurate data during
the process of data input.
2.1 Data Input and Sources of Error
Garbage-in-garbage-out (GIGO)
Garbage in
Transcription error
An example of garbage-in-garbage-out
The position numbers in all exam reports are wrong. They are regarded as errors and they are garbage.
Garbage out
2.1 Data Input and Sources of Error
Garbage-in-garbage-out (GIGO)
Garbage in
Transcription error
The position numbers in all exam reports are wrong. They are regarded as errors and they are garbage.
An example of garbage-in-garbage-out
Garbage out
2.2 Data Control
Two types of data control to reduce data errors:
Data
validationData
validationData
verification
Data verification
Data Validation The process of comparing data with a set of rules or
values to make sure that the data is reasonable and valid
Can detect some invalid data in the source documents
2.2 Data Control
Data Validation
Different types of validity checks and their uses
Validity check Function Example
Field presence check
Ensure that all necessary fields are present.
The student number must be included in the student record.
Field length check
Ensure that the data has the correct number of characters or digits.
A domestic telephone number in Hong Kong must have 8 digits.
Range check Ensure that the data value is within a pre-determined range.
The mark of a test should range from 0 to 100.
Fixed value check
Ensure that the data conforms tobe one of the values in a predefined list.
The gender of a student must be either ‘Male’ or ‘Female’.
Format check Ensure that the form of data follows some known patterns.
The e-mail address must be a combination of a user name and a domain name with the symbol ‘@’ in between.
2.2 Data Control
Data ValidationValidity
check Function Example
Type check Ensure that the data types are correct.
The students’ examination marks should be numbers but not characters, while their names should be characters but not numbers.
Check digit
It is used for self-checking. With numeric data, a check digit is calculated using a mathematical formula and this is then attached to the end of the number. When the check digit of the number matches the digit calculated from the number, the number is confirmed valid.Parity check is a common application of check digit in digital data transmission.
The check digit of ISBN.
Different types of validity checks and their uses
2.2 Data Control
Data Verification A control used to check whether the inputted data
matches that in the source document Two methods commonly used for data verification:
Input data twiceInput data twice Double data
entry
Double data entry
2.2 Data Control
Input Data Twice An operator inputs the data twice and allows the
computer system to check the second entry against the first one.
It reports any discrepancies and the operator is required to correct the error manually.
Example: When changing the password of your e-mail account, you
have to re-enter the password for confirmation.
2.2 Data Control
Input Data Twice
Input data twice
2.2 Data Control
Double Data Entry Two operators enter the same source document into two
different files. The computer compares the two files and reports any
discrepancies between them. The discrepancies must be checked and corrected
manually.
2.2 Data Control
Double Data Entry
Double data entry
1st operator
2nd operator
Check for discrepancies
2.2 Data Control
Double Data Entry
1st operator
2nd operator
Check for discrepancies
Double data entry
2.3 Data Hierarchy
The data hierarchy of a database system can be divided into 4 levels:
Field Record Table Database
2.3 Data Hierarchy
Database Hierarchy
Level Description Example of usage
Field
It is the smallest unit of data that can be accessed by a user.
Represent a specific fact of a
record. Can be of type: numeric,
text, date, Boolean, etc.
Telephone number Mailing address Monthly income Marital status
Record
It is a collection of related fields.
Contain information of one specific entity.
The data in a key field can be used to uniquely identify one
particular record from the others.
Data hierarchy
2.3 Data Hierarchy
Level Description Example of usage
Table
It is a collection of related records with identical record structures.
Contain the information of all entities stored in specific record format.
All records in a table have unique and different values in key field.
Database
It is a collection of related tables.
May link records from different tables dynamically with one or more key fields.
Data hierarchy
Database Hierarchy
Two tables can be linked with a key field.
2.3 Data Hierarchy
Database
Record
Field
Hierarchical structure of data
2.3 Data Hierarchy
Database
Record
Field
Hierarchical structure of data
2.4 Database Management System (DBMS) DBMS is a computer program that provides functions to:
manage the database structure store, organize and retrieve data in a database
Application of DBMS Example
Database serverMySQL, Oracle Enterprise Manager, Microsoft SQL Server
Small office and personal use
Microsoft Access, Microsoft Visual FoxPro, FileMaker Pro
Examples of DBMS
2.4 Database Management System (DBMS)
Examples of database server
MySQL
Oracle Enterprise Manager
2.4 Database Management System (DBMS)
Examples of DBMS for personal use
Microsoft Access
Visual FoxPro
2.4 Database Management System (DBMS) Basic Functions to Organize Tables
Basic DBMS functions for organizing a table
Function Description Example
Create table
Create a new table and specify the record structure.
To create a table ‘student’ with fields ‘Name’, ‘ID’ and ‘Age’:
SQL commandCREATE TABLE student (Name char(24), ID char(8), Age decimal(3,0))Microsoft Access (in Design View)
2.4 Database Management System (DBMS) Basic Functions to Organize Tables
Function Description Example
Modify table
Change the structure of an existing table.
To remove the field ‘Age’ from table ‘student’:
SQL commandALTER TABLE student DROP Age
Microsoft Access (in Design View)
Basic DBMS functions for organizing a table
2.4 Database Management System (DBMS) Basic Functions to Organize Tables
Function Description Example
Delete table
Remove a table from a database. All records in the table will also be deleted permanently.
To remove table ‘student’:
SQL commandDROP TABLE student
Basic DBMS functions for organizing a table
2.4 Database Management System (DBMS) Basic Functions to Manage Records in a
Table
Basic DBMS functions for manipulating table records
Function Description Example
Add a new record
Create a new record. Users are subsequently able to input information into it.
To add a new record:
SQL commandINSERT TABLE student VALUES ("Ada Lee", "92001", 15)Visual FoxProAPPEND
2.4 Database Management System (DBMS) Basic Functions to Manage Records in a
TableFunction Description Example
Delete existingrecords
Remove unwanted records from a table.Users can issue a delete command with a condition statement such that all records matching the condition will be deleted at one time.
To delete all records of students who are younger than 14-year old:
SQL commandDELETE FROM TABLE student WHERE Age < 14Visual FoxProUSE studentDELETE FOR Age < 14
Note: All the matched records are marked for deletion. They will be removed permanently by issuing the command PACK.Basic DBMS functions for manipulating table records
2.4 Database Management System (DBMS) Basic Functions to Manage Records in a
TableFunction Description Example
Modify existingrecords
Change the field values of selected records.Users can issue an updatecommand with a condition statement such that all records matching the condition will be changed at one time.
To add 1 to all records in the ‘Age’ column for students whose age are 16 or above:
SQL commandUPDATE TABLE student SET Age = Age + 1 WHERE Age >= 16Visual FoxProREPLACE Age WITH Age + 1 FOR Age >= 16
Basic DBMS functions for manipulating table records
2.4 Database Management System (DBMS) Basic Functions to Manage Records in a
TableFunction Description Example
Browse records
Display all or part of records of a table in a window.Users may also be allowed to add, modify or delete records in the browse window.
To display all records in a browse window.
Microsoft Access
Visual FoxProUSE studentBROWSE
Double-click to open a browse window for the table ‘student’.
Basic DBMS functions for manipulating table records
2.4 Database Management System (DBMS) Essential Features for Database
Management Provides features to:
facilitate the data input in data entry forms display results in query forms and generate reports
Filter Allows users to specify a filtering condition Only the records that satisfy the condition are accessible
in the database table. The unmatched records are hidden temporarily until the
filter constraint is released.
2.4 Database Management System (DBMS) Essential Features for Database
Management Filter
Table containing all records
Define a filter (e.g. logon is equal to "Y")on a table.
Filtering records from a table
2.4 Database Management System (DBMS) Essential Features for Database
Management Filter
Table shows records that satisfy the filtering condition.
Filtering records from a table
2.4 Database Management System (DBMS) Essential Features for Database
Management Sort
Change the order of records according to the value of one or more fields in a table.
The sorted records are usually saved in a new table.
Unsorted records in the table ‘Userlist’
Records are sorted by ‘Fullname’ and are stored in a new table ‘Sortedlist’.
Sorting records in a table
Visual FoxPro command:Sort to sortedliston fullname ascending
2.4 Database Management System (DBMS) Essential Features for Database
Management Sort
Allows records to be rearranged in a specific order permanently
A slow process if the number of records is large Index
A small file containing a number of index keys. The index keys are created and arranged according to
the index expression. One index file refers to one instance of a specific table
only. An index file must be re-indexed when values of the field
involved in the index expression have been changed. The index files are usually small relative to the referred
table. They can be loaded into the main memory for speeding
up the access process.
2.4 Database Management System (DBMS) Essential Features for Database
Management Index
A Visual FoxPro example showing how to access records by using an index file
Create an index file:Index on Fullname to user_index ascending
Unsorted records in the table ‘Userlist’
Records are accessed according to the order specified the index file.
Fullname Rec. No.
Joyce Wong 2
Ko Ko Lo 4
Mark White 3
Ricky Mok 1
2.4 Database Management System (DBMS) Essential Features for Database
Management Index
Records are accessed in the original order as stored in the table ‘Userlist’.
Stop using the index file:Set index to
A Visual FoxPro example showing how to access records by using an index file
2.4 Database Management System (DBMS) Essential Features for Database
Management Data Entry Forms
Can be treated as the interfaces for adding or modifying records
Advantages: Provide a user-friendly environment for data entry Perform data validation such as range check and type check of
test marks Perform data verification such as double data entry of renewal
password Simplify data entry with features like pull down menu, check
box and list box Modify related records from two or more tables in one form
2.4 Database Management System (DBMS) Essential Features for Database
Management Data Entry Forms
Data entry form of Microsoft Access
2.4 Database Management System (DBMS) Essential Features for Database
Management Query Forms
Provide an interface for users to extract and display records which match the specified conditions
The extracted data can further be modified, deleted or stored in a new table.
Define queries with selection criteria in the Design View.
Display selected records in query windowtemporarily.
Extracting data by using query form
2.4 Database Management System (DBMS) Essential Features for Database
Management Query Forms
Advantages: Can be stored and are reusable Able to show data from two or more tables Able to display calculated results using the extracted records
Writing commands in Structured Query Language (SQL) is another way to enquire about results from a database.SELECT bookname, type, price FROM book WHERE ((type = 'IT') or (type
= 'ENG'))
2.4 Database Management System (DBMS) Essential Features for Database
Management Reports
Used to display results on the computer screen or produce hard copies with a printer in the defined format
Advantages: Can be stored and are reusable Able to display data and calculated results from two or more
tables. Able to print results in specified locations, styles and formats
accurately
2.4 Database Management System (DBMS) Essential Features for Database
Management Reports
Creating a report in Microsoft Access
Click the ‘Report’ button.
2.4 Database Management System (DBMS) Essential Features for Database
Management Reports
Click the ‘Report’ button.
Creating a report in Microsoft Access
2.5 File Access Modes
The access mode used to access database records depends on which media the database resides in.
Sequential access mode Hard disk Optical disk Floppy disk
Direct access mode Magnetic tape
2.5 File Access Modes
Using magnetic tapes to back up data in a large organization Using hard disks in a server
room
2.5 File Access Modes
Sequential Access Mode Magnetic tape
Data records are stored one by one along the lengthy magnetic strip.
Need to be rewound forward or backward until the desired record is just underneath the read/write head before the reading or writing operation can proceed
The seek time is long and unpredictable when records are retrieved randomly.
Not a common medium for storing frequently used data records
Mainly used for backing up and recovering of database and data files in computer servers
2.5 File Access Modes
Direct Access Mode Hard disk
The most common storage medium for secondary storage due to its high reliability, speed and capacity.
During read/write operations, the magnetic disk plate (platter) rotates and the read/write head moves across the platter surface at the same time to the location containing the data.
Once the target location is moved under the read/write head, the read/write operations can proceed.
The seek time is much shorter and predictable, ranging from 8 ms to 20 ms.
The most essential secondary storage device for a computer system
2.5 File Access Modes
Direct Access Mode Hard disk
Read / write head movesacross platter surface to the right track and waits for the arrival of target data.
Target data
Platter surface rotates to move the data to the read / write head.
The working mechanism of a hard disk
2.5 File Access Modes
Direct Access Mode Other examples:
Floppy disks DVD-RAM CD-RW
They are limited in capacity and speed of data access. They are rarely used as the storage media for database
systems and frequently used data files.
2.5 File Access Modes
Direct Access Mode Other examples:
Floppy disks DVD-RAM CD-RW
They are limited in capacity and speed of data access. They are rarely used as the storage media for database
systems and frequently used data files.