Maintaining Data
File maintenance refers to the procedures that keep data current. File maintenance
procedures include adding records to, modifying records in, and deleting records from a file.
Adding Records
Users add new records to a file when they obtain new data. If a new student is admitted to
the school, an admissions department clerk adds a new record to the Student file. The process
required to add this record to the file might include the following steps:
1. An admissions department clerk uses the database management system (DBMS) to display
a Student Maintenance Form that gives him or her access to the Student file.
2. The clerk fills in the fields of the student record
with data (except for the Student ID, which
automatically is assigned by the DBMS).
3. The clerk takes a picture of the student using a
digital camera.
4. The admissions department clerk verifies the
data on the screen and then instructs the DBMS to
add the new student record to the Student file.
3. The clerk takes a picture of the student using a digital camera.
4. The admissions department clerk verifies the data on the screen and then instructs the DBMS
to add the new student record to the Student file.
Modifying Records
Generally, users modify a record in a file for two reasons: (1) to correct inaccurate data or (2) to
update old data with new data. Suppose, for example, that Samantha Gastanes moves from 2 East
Penn Drive to 212 F. Ramos Street. The process to change the address and update Elena Gupta’s
record might include the following steps:
1. The admissions department clerk displays the Student
Maintenance Form.
2. Assuming Elena Gupta is present, the clerk inserts Elena’s
student ID card in a card reader to display her student record
on the screen. If Elena did not have her ID card or was not
present, the clerk could enter Elena’s student ID number — if
Elena knew it. Otherwise, the clerk could enter Gupta in the
Last Name field, which would retrieve all students with that
same last name.
The clerk then would scroll through all of the retrieved records
3. The DBMS displays data about Elena Gupta so that the clerk can confirm the correct student
record is displayed.
4. The clerk enters the new street address, 76 Ash Street.
5. The admissions department clerk verifies the data on the screen and then, if required, clicks
the save button to modify the record in the Student file. The DBMS modifies the record on the
disk.
Deleting Records
When a record no longer is needed, a user deletes it from a file. Assume a student
named Kate Mendiola is moving out of the country. The process required to delete a record
from a file includes the following steps:
1. The admissions department clerk displays the Student Maintenance Form.
2. The clerk displays Benjamin Tu’s student record on the screen.
3. The clerk confirms the correct student record is displayed. Then, the clerk clicks the
Delete button to delete the record from the Student file and then, if required, clicks the
Save button to save the modified file.
DBMSs use a variety of techniques to manage deleted records. Sometimes, the DBMS
removes the record from the file immediately, which means the deleted record cannot
be restored.
Other times, the record is flagged, or marked, so the DBMS will not process it
again. In this case, the DBMS places an asterisk (*) or some other character at the
beginning of the record.
DBMSs that maintain inactive data for an extended
period commonly flag records. For example, a
school might flag inactive students. When a DBMS
flags a deleted record, the record remains
physically on the disk. The record, however, is
deleted logically because the DBMS will not
process it
Validating Data
Validation is the process of comparing data with a set of rules or values to find out if the
data is correct. Many programs perform a validity check that analyzes data, either as you
enter it or after you enter it, to help ensure that it is correct. Validity checks reduce data
entry errors. Various types of validity checks include alphabetic checks, numeric checks,
range checks, consistency checks, and completeness checks. Check digits also validate data
accuracy.
Alphabetic/Numeric Check
An alphabetic check ensures that users enter only alphabetic data into a field. A numeric
check ensures that users enter only numeric data into a field.
Range Check
A range check determines whether a number is within a specified range.
Consistency Check
A consistency check tests the data in two or more associated fields to ensure that the
relationship is logical and their data is in the correct format.
Completeness Check
A completeness check verifies that a required field contains data.
Check Digit
A check digit is a number(s) or character(s) that is appended to or inserted in a primary key
value. It often confirms the accuracy of a primary key value. Bank account, credit card, and other
identification numbers often include one or more check digits.
Other Checks
DBMSs that include hyperlink and attachment
data types can perform validity checks on data
entered in those fields. Hyperlink entries can be
tested to ensure that the Web address follows the
correct format and that the link works. Similarly,
an attachment entry can be validated by
confirming that the file exists.