File Operations
The common operations carried out on files are :

 

Sorting

 

Files may be sorted into order of a field. The records are arranged in ascending or descending order (numerically or alphabetically).

If records are sorted it is much easier and quicker to find a record.

Searching Queries are used to find records which match certain conditions.

Simple query - Using one field.
Eg (NAME = 'Smith')

Complex query - using two or more fields with OR, AND or NOT.
Egs
(NAME='Smith') AND (BALANCE > £100)
(PET='Dog') OR (PET = 'Cat')
(PET = 'Dog') AND NOT (Type='Spaniel')

Wildcard query - In alphabetical fields * may stand for anything.
Eg (NAME = 'Sm*')
will include all names starting with Sm - Smith, Smithers, Smedling and so on...

Adding new data  A new record may be added to a file.

Eg A business may start to sell a new brand of item.

Deleting data A record may be removed from a file.

Eg A business discontinues the selling of an item.

Editing data A record in a file may be changed.

Eg If the price of an item changes.

 

 

The buttons used for sorting may look like these..

 

 

 

With Queries, the names of the Fields must be given as well as the data to be searched for.

 

Exercise : File Operations
A file may be sorted - arranged in ascending or descending order of one of the fields.

A file may be searched for records satisfying given conditions. are used.

Examples of queries :

(TYPE='Bicycle')
(TYPE='Bicycle') AND (PRICE < £200)
(NAME = 'B*')
to find all names starting with 'B'

New records may be added. Eg

Old records may be deleted. Eg

Records may be changed. Eg

 

(Green indicates success)