You are on page 1of 19

WHAT IS A DATABASE?

The term database describes a collection of data organized in a manner that allows access, retrieval ,and use of
that data. A database is a structure that can hold data concerning many different types of objects (technically
called entities)as well as relationships between this objects. For example a companys data may hold data on
such objects as sales reps and customers. In addition ,the database would include the relationship between sales
reps and customers; That is ,we could use the data in the database to determine the sales rep who represents any
particular customer and to determine all the customers who are represented by any given sales rep.
Below is an example of a database.
NAME

SUBJECT

GRADE

JANE KARIUKI
WILFRED ONYANGO
SUSAN OKETCH
WILLIAM LUGALI

MATH
ENGLISH
GEOGRAPHY
HISTORY

56
67
45
65

In essence tables form a sort of database even when they are on paper. A database management system or
DBMS is a software product that can be used easily to create a database; make additions, deletions, and
changes to data in the database; sort the data in the database; and retrieve data from the database in a variety of
ways. Foxpro is the most widely used DBMS. Foxpro is a data processing program. The columns for the
name the subject and the grade are called fields in foxpro. Fields simply contain related information. The
name column would be in foxpro a character column so would the subject column. The grade column however
will be a numeric field. You can have in addition, date,logical and memo fields.
To load foxpro use the DOS CD command to gain entry into the directory which contains the foxpro program
files eg CD FOXPRO2 from the hard disk. Type FOX at the dos prompt to start the program.
In foxpro you can work from two modes the assistant or the dot prompt.
PLANNING A DATABASE FILE.
Before using foxpro to create a database file you must perform four steps
1.Select a name for the database.
2.Define the structure of the database.
3.Name the fields.
4.Determine the type and the width of each field.
NAMING A DATABASE
The name can be up to 8 characters but not more. You should select names which are as meaningful as
possible.
Defining the structure of a database
You must determine the fields that will make up the file. The fields you want to include must be based upon the
type of information you want to extract from the database. To make a database for employees,lets call it
EMPLOYEE. We will require information on the employee number the employee name ,the date hired ,the
department name ,the pay rate ,and the field that tells whether or not the employee is a member of the union. In
foxpro you can have a maximum of 128 fields and records can be a maximum of 400 characters long.

NAMING THE FIELDS


You must assign a unique name to each fields in the database.
A field name can contain up to 10 characters
-No blank spaces are allowed
Below is a chart which illustrates the field names that will be used in the sample file.
FIELD DESCRIPTION

FIELD NAME

EMPLOYEE NUMBER
EMPLOYEE NAME
DATE HIRED
DEPARTMENT NAME
PAY RATE
UNION MEMBER

NUMBER
NAME
DATE
DEPARTMENT
PAY_RATE
UNION

DEFINING FIELD TYPES


1.Character fields
These fields may be used to store any printable characters that can be entered on the keyboard.
2.Date fields
These are used to store dates
3.Numeric fields
These fields are used to store integer or decimal numbers
4.Logical fields
These consist of a single value representing a true or false condition. The entry must be T for true or F for
false,or Y for Yes and N for No.
5. Memo fields
Memo fields are used to store large blocks of text such as words or sentences.
Indicating width and Decimal Position
The width of the field indicates the maximum number of characters that will be contained in the field.
THE ASSISTANT
The assistant is a collection of menus that help you in processing the data in a database.
When you use the menus you are in the assist mode. The names of the various menus are displayed across the
top of the screen.
In foxpro they are:
-System, File, Edit, Database, Record , Program and Window.
You can invoke each of this menus by pressing ALT+ letter key combination. For instance to invoke the file
menu, you press
ALT + F. You navigate the highlight bar by using the right, left, top and bottom arrow
keys to move in the right direction.
To create a database file simply move the cursor to the File menu and select New in foxpro. In foxpro enter
over the "Create" menu under the item "Data".
You have to provide a name for the database file in foxpro and where it is to be placed. In foxpro this will
come after you have made the database structure.
THE COMMAND PROMPT
From the menus you can move to the dot prompt by pressing the ESC key. In foxpro the change will be
immediate. At the prompt which is also known as the command prompt you will view the commands that you
enter and also will be allowed to enter new commands. When you use the menu foxpro actually constructs the
commands for you whereas when you use the command prompt you have to input the commands yourself.
QUITTING
To quit foxpro simply type Quit at the dot prompt or press ALT+ F to access the menu , move the highlight to
the quit option and press the enter key.
GETTING HELP
If you need additional help simply press F1 from either the dot prompt or the assist and you will be moved
immediately to the help feature of foxpro. press enter over any highlighted object and you will get more
information about that topic. You can navigate over the different choices using the arrow keys until you have
reached the selection you want.
CREATING A FILE.

- At the File menu press the enter key. A database design screen appears.
- Enter "name" in the first prompt to create the first field , ie the name field. Accept the default character
field type.
-Enter 15 in the width column and press enter.
Repeat the above steps for the field information shown below
NUM
2
3
4
5
6

FIELD
NUMBER
DATE
DEPARTMENT
PAY-RATE
UNION

TYPE
NUMERIC
DATE
CHARACTER
NUMERIC
LOGICAL

WIDHT

DEC
4
8
10
5
1

To change the field type simply press the Enter key and press enter over the right selection.
Type "Employee" in the Prompt that appears as 'save as' for the name of the file. Press CTRL + W to
proceed to save the database and exit.
Entering and editing data.
ADDING NEW RECORDS TO A FILE.
You can enter information for new records through either a browse or edit screen. To switch from either the
browse screen to the edit screen type Browse or Edit at the dot prompt.
TO ADD A NEW RECORD:
-Press ALT +R to invoke the Records menu. From the records menu , select the Append option. A blank
record is displayed ready for infilling. You can now enter data into each field. For the employee database file
enter the following information.
Rapoza ,Anthony P.
1011
01/10/94
Shipping
8.50
.T.
After one record is full the record pointer moves to the next blank record.
fill in the rest of the information.
NAME

NUMBER

McCormack L.
Ackerman
Doi Chang J.
Castle C.
Baxter C.

1013
L.
1017
1020

DATE
01/15/89

1016
1037

DEPARTMENT PAYRATE
Shipping

8.25
Accounting
02/05/93
Production
6.00
03/04/93
Shipping
7.50
05/05/93
Accounting
01/04/93

EDITING EXISTING DATA


You will usually have to update data in your database sooner or later.
Changing data in a database.

.T.
9.75
11.00

.T.
.F.
.T.
.T.

UNION

You can edit in the Browse screen as easily as in an Edit screen. To edit a file you have first of all to use the
file. To do this from the dot prompt simply type Use <filename>. To use the employee file you created for
instance you will type Use Employee.
-Select Browse from the Database menu. The highlight moves to the top record. To alter a record simply
move the highlight to the record entry you would like to edit and make the appropriate alterations. TO move to
the next record press PageDown.
To erase the contents of an entire record simply press CTRL + Y. If you erase a record by mistake you can
undo the damage by selecting the undo in the Edit menu.

FOXPRO exercise
1.
You have been asked to design and create a database file to store Information about a Music Library.
The music is stored either Cassette tape (CS), Long playing records (LP), or Compact disk (CD) as indicated by
the entry. Make an appropriate database and call it task1
On 22nd of February 93 we obtained Greatest Hits by Parache, Milo on an LP costing $8.95 and was classified
as Classical. And rest followed up as follows :02/15/93
America,
Judd,Mary
CS
$5.95
Vocal
01/02/93
Rio Rio,
Duran,Ralph
LP
$8.95
Rock
02/15/93
Passione,
Parache,Milo
LP
$6.99
Classical
01/02/93
Country Hills
Lager,Ricky
CD
$11.95
Country
02/22/93
Rockin'
Brady,Susan
CS
$5.95
Rock
02/22/93
Pardners
Huddson,Landy
CS
$5.95
Country
01/20/93
Private Love
Toner,Arlene
CD
$11.95
Vocal
02/22/93
Moods
Silver,Sandy
CD
$11.95
Rock
2. Print the Database file and its structure [20 Marks]
Display and print the records for the classical music
Print all the records for all music on compact disk
Display and print the records for all rock music that cost less than $48.95
Print the artist and music name for all rock music that is unavailable on cassette tape.
OPENING AND CLOSING MEMO FIELDS.
To enter a memo field move the highlight to the field entry and press CNTRL-HOME. This will allow you to
open the memo which contains extra information about your data entries. You can use DEL or BACKSPACE
to edit the information. Once you finish editing the text in a memo field press CNTRL-HOME to close the
memo field..
REMOVING RECORDS FROM A DATABASE.
You can mark records for deletion from either the Browse or Edit screen.
Press ALT + R to move to the Record menu While in the browse or edit menu. To mark a record for deletion
select delete option from the Record menu. A new screen appears. Enter over the Scope option. A new
screen appears. Move the cursor to the Record option and press the Enter key. Enter the number of the
record you want to delete and then press CTRL + W. two times. Once a record is marked for deletion Del
appears at the extreme right portion of the status bar. Press ALT +R again to invoke the records menu. Select
the Recall Option.
Execute the same steps as when you are deleting the record and dont forget to press CTRL + W two times after
you have finished indicating the record number you want to be deleted.

ERASING MARKED RECORDS.


Marked records can be permanently erased through an option in the Database menu.
invoke the Database menu.
Select the Pack option. Select Yes to permanently erase the records from the file.

Press ALT + D to

FOXPRO EXERCISE
The Safari Rally is a dramatic sporting encounter, a glamorous spectacle and is a very complex event. You
have been asked to prepare a well laid out database to keep track of this great Easter event. The following
drivers and co- drivers had registered as per 8 April 1993. Create an appropriate database file and call it task2
1. J Kankunen/J Puronener in a Toyota
2. M Alen / I Kirimaki Toyota
3. I Duncan / I Munro Toyota
4. K Shinozaka / P Kuukkala Mitsubihi
5. Y Iwase/S Vvinayak Toyota
6. McRea / D Ringer Subaru
7. P Njiru / R Matthews Subaru
8. M Ishida / M Verjee Subaru
9. H Nishiyama /R Sugiura Nissan
11. R Stehl / P Diekmann Audi
12. M Brighetti / A Sidi Daihatsu
14. J Toroitich / I Choge Toyota
15. A Anwar /S Shah Subaru
16. M Stohl / K Geriach Audi
17. H Shamji / P Stone Subaru
18. R Chager / Subaru
19. G Jack / D Page-Morris Daihatsu
20. G Edmunds / J Dennis Mitsubishi
21. S Aslam / F Yusuf VW Golf
22. A Pattni / Z Mughal Daihatsu
23. N Kassam / M Khan VW Golf
24. J Ngunjiri / W Kimaru Toyota
26. M Shamji / S Thatthi Toyota
27. A Anwar / R Corcoran Daihatsu
28. R Boyd-mos / M Trower Ford
29. M Nitta / D Macharia Toyota
30. C R Palel / J Marjar Toyota
31. T Alam / A Khan Subaru
32. D Smith / G Shaw Ford
33. P Bailey / H Trempehau Toyota
34. F Vilasenor / T Alam Subaru
35. S Reininger / R Brandstatter Subaru
37. P M Kimathi / A Muhindi Mazda
38. F Kayser / S Haji Subaru
39. R Bhatt / Y Asami Subaru
40. S Allibhai / R Premji Subaru
41. M Tilbury / U Miersch
43. Van Tongereu / S Andrade Peugeot
44. C Kyriti / B Behr Mazda
45. Tsaito / K Seigo Toyota
46. Glenn f/ T Fennedes Subaru
47. A Sembhi / S Rey Toyota
48. G Kibiti / R Dennis Toyota
49. Bowles / Steve A Toyota
50. J wahome / K Maingi Subaru

52. Y Patel / P Patel Subaru


*

When mandatory checks were made on all cars assembled at Kenyatta International
Conference Center 10 were informed that they must pass a re-examination by 11 am when the
first car was expected to leave at the start of the 41st Safari and it is in accordance with the
Federation of International Auto Sport (FISA) rules. Amongst them are cars no.
24.37,48,50,26,27,29,33,40,47 mark the records for deletion and print the database.

Cars no. 46 and 49 were knocked out outright because they were over the allowed 2.5 liter
power, delete the records.

Modify your database structure after considering the following information


*
The following cars are retired
4, 6, 8, 9, 24, 26, 27, 28, 31, 43, 44, 45, 47, 52
The following cars were time barred
14, 15, 20, 23, 30, 32, 37, 38, 40, 41, 48, 50.
*
1 position 1
2
3
5
7
11
12
16
17
19
21
22
29
33
39
35

Overall winners were car no.:"


"
"
"
"
"
"
"
"
"
"
"
"
"
"

2
3
4
12
8
7
10
9
5
11
6
13
16
15
14

TO COPY DATA FROM A FOXPRO FILE


The Copy To Option in the Database menu allows you to copy a foxpro file to another format eg lotus 123.
Press ALT+ D to invoke the Database menu. Select Copy to. In the <Save As> Box, type the name of the
file you want the new file to be called. Press Enter to move to the TYPE box. Press the Enter key over this
box to access the several choices of files you can convert to. Select the type you want and then press CTRL +
W. Your new file is created.
FINDING AND ARRANGING DATA.
FINDING THE FIRST AND LAST RECORDS
Press ALT + F to select the file menu. Move the highlight to the Open Option and then press the enter key.
Move the highlight over the file you want to use and Press Enter. This puts the database file in use and when
you use the Append command, displays its records. To reach the last record in a database file select the Goto
option of the Record menu. Now select the Bottom Option and then press CTRL + W. You can tell that this
is the last record in the file from the status bars record pointer. If the file has 20 records the last file will be
indicated as 20/20 on the status bar.
Finding specific records
When you are in the Browse screen , to move through a file records one screenful at a time, press PgDn key.
To move upwards through a file one screenful at a time, press PgUp key.
Going to a specific record number.
To reach any record number select record from the Go to option of the Records menu.
A prompt asks you to enter the number of the record. Type the number of the record and press the enter key.
Record numbers only indicate the order of record entry and are not permanent.
SEARCHING FOR PARTICULAR RECORDS.
You can locate particular records by using the locate option of the Record menu. Select the locate menu in
the record menu. Select the For option in th new screen which is presented to you. A new screen is shown.
Type the criteria for the selection of the record For instance to find the name of an employee called Parache,
Milo in the Employee database. Type in the following string.
NAME="Parache, Milo". Press CTRL+W two times.

FOXPRO EXERCISE
1. You work in a Computer Software Store. Today's first task is to design and create a Database to store
information about the inventory of a company that sells computer software.
Below is the information about your inventory:Create a database and call it task3 and input all the information.
You have 5 boxes of DataburstDC costing $229.95, supplied by Electric Software Limited
22 crates of TypeEaseWN @$29.95, made by Edusoft Inc 12 cartons of image fontsWC supplied by Graph
Tecl Inc
DatafilerDC @ $49.95, made by Anchor software limited 18 sets
20 dozens of MasterEN @$149, made by Edusosoft Inc.
Math TesterEN, 10 Cartoidges Costing $49.95, made by learnit Software Ltd.
30 Copies of PC-WritesWN @$4995, Supplied by Anchor Software ltd
16 dozens of print-fileDC @$129.95, supplied by Graph tech Inc.
34 boxes of learning CalcSC @$99.95, made by Edusoft Inc
8 Cartons of Number CrunchSC @$69.95, supplied by Ancho soft.
50 Copies of ParadoxDC @$500, made by Ashton tate. Save your file.
Use the software Inventory database that you created to solve these problems:2.We have, more software on hand from suppliers
10 Cartons Quick fileDC cost $99.95, supplied by Electric Software ltd
12 boxes of Math DrillEN bought @ $29.95, supplied by Edusoft Inc.
6 boxes of script printWC by Graph tec Inc. costing $49.95
5 copies of laser printWN by graph tech inc. costing $199.95
20 Cartridges of speed calcSC by Anchor software costing $49.95
DATABASE

|
D
|
WORDPERFECT (WP)
|
W
|
EDUCATION
|
E
|
SPREADSHEET
|
S
|
COMPATIBLE WITH MS-DOS
|
C
|
NON COMPATIBLE
|
N
|
( 50 Marks)
3.Obtain a list of all the following-:
a] Image Fonts
b] All software Produced by the company Anchor Software
c] All the Software in the Education Category
d] All Inco operation companies
d] All records with a quantity less than $10 and Quantity Greater than $25
e] Word processing Software that cost less than $50.00
ORGANIZING DATA
This can be through sorting or indexing.
When sorting , foxpro rearranges records according to an organizing principle , such as name or department. It
actually creates a new file with extension DBF on disk.
Indexing is quicker and more efficient than sorting. An index is essentially a file that references items in a
database according to a specified criterion, with a pointer to where the record is stored. Records in a database
file are stored in the order in which they were entered. Once you organize records with an index, the order in

which the records appear is different , although they are still stored in the original order. Indexes take up less
space. foxpro can construct and manipulate an index more quickly than it can sort the database file.
Index key or expressions can be an existing field or a combination of fields.
CREATING AN INDEX
To index the employee database by name press ALT + f. Select new Move the cursor to the index option and
mark it using the space bar then press CTRL + W. Select the fields to index on, Index expr, order and tag
name. Press CTRL + W
(e.g. INDEX ON NAME DESCENDING TAG NAME ADDITIVE
This command enables one to index a file in descending order on the field NAME using tag NAME.)
The first window database Fields, lets you choose the field name on which to build the index. The next
window options allows you to specify an index expression. The third window index on enables you displays
the fields you are indexing on.
Move the highlight to name and press enter once to select the field The next option asks for the order of the
index Ascending and Descending. Press CNTRL + W to save the name index
To see the data in the new order type list at the dot prompt Notice that now the records are organized
alphabetically by name.
Unique indexes remove duplicate records from your file. For instance if you organized on the field
department and you chose unique index you would only see the record of the first occurrence of an
individual in each department. That is to say you would only see one record for each department.
SORTING A FILE.
When sorting foxpro actually rewrites the file such that you now have two versions instead of one. Sorting
however takes more time than indexing.If you wanted a permanent file in the order of the index you just
created;
-Select sort from the Database menu.
A box displays in which you enter the names of the fields to use for sorting. Select the field on which you want
to sort on by pressing the Enter key over it. Press the tab key several times untill the cursor is the <save as>
box. Type the
Select whether the file is organized in an ascending order or a descending order.
Press CNTRL + W to save and enter the name of the new file when prompted by foxpro Give the name
employee1.
To see the new changes select the file employee1 and notice that it is sorted by name.
FOXPRO EXERCISE
Use task 2. Index on the make of the car to create an index file called task2.ndx. list the new index file on the
screen.
Use task1 sort the data on the type (eg LP etc) to a sorted file called task1s. Display the new sorted file on the
screen
PRINTING IN FOXPRO
You have to connect a line printer to your computer before you can print.
To print data quickly without paying much attention to its appearance select print from the file menu. Make
sure that a file is in use before you do this. The print window appears.
From the window options select COMMAND and then press CTRL + W. Your database will be printed directly
on the printer.

QUERIES
Queries are files that help you to sift your database for records that meet a given criteria.
To create a query select query from the file menu's new option. Then press CTRL + W and a RQBE window
appears. The queries design screen appears on the screen. Move the highlight to the field name options.
Press the space bar to select the field which you would like to search. In the next options, you can select from
the following operators for a match;
like
exactly like
more than
less than
between
in
You can then enter the search criteria in the adjacent text box. For instance , if you had selected UNION as
your field in the employee database file you can input.T. in the text box to get a list of all the employees who
are in the union. Press CNTRL+W to save. To view the records which meet the criteria press enter over the
Do Query prompt.
FOXPRO EXERCISE
Use task3 create a query file to list only the software which are compatible with MSDOS or the software which
is spreadsheet
FORMS
Forms display your data in a customized format. You can design them to mimic paper forms you already use.
To create a form select form from the file new option. The form design screen appears. Press Alt + c + q.
Press CTRL + W two times and the fields of your data base will be placed on the screen. To move a field press
space bar on it then use the arrow keys to arrange the fields in any place on the screen To draw either single line
boxes or double line boxes select box from the screen menu. Stretch the box to the desired size and then press
enter. To save the screen press CTRL + W.

FOXPRO EXERCISE
-Use task3. Make a good format for screen for the database in order for easy entry of data. Create a new field
(memo Type) to keep more information about the software.
-Use task1. Make a suitable format for screen for the database with the same specifications as above.
REPORTS
Report files organize and print your records in a format you specify. Foxpro reports provide a flexible way for
you to print your data. For example,you can organize your data in groups, print totals for subgroups ,and then
print a grand total. You can choose only certain fields to appear in the report or decide to print only certain
categories of records.
To Create a report select report from the file menu's new option. Press ALT + O. Select Q from the report
menu to create a quick report on the screen. If you want to view the report on the screen select preview from
the report menu. However you can still modify the report according to your preferences. You can input a
header for your report , a footer or any other messages that you will like to appear in the report. You can also
send mail to your freinds or customers using the reports routine.
LABELS

label files contain instructions for printing labels in customized formats. You can design a label to print only
the fields you want to use from the database file, in any order you want. Foxpro provides predetermined sizes
for labels or you can specify a custom size.
Select label from the file menu's new option. Select the label sizes that you will wish to have by highlighting
the appropriate option of the size menu and pressing enter. Select the fields that you will like to appear in the
labels from the label menu.
To print out the labels you will select the print opion from the file menu. You can now press CTRL + W to save
the label.
FOXPRO EXERCISE
You have been recently employed at central police station to computerize their records based on their day today
reports. The following is an extract of the records.
Jan 10th 1988
(a) Mazda KQF 992 Was reported stolen in majengo. Reporting
officer Tom
(b) Kshs. 200,000.00 was reported stolen from KARURI INDUSTRIES in
Muthaiga - Reporting officer
Peter
(c) Three people were hurt in a car crash at BURU BURU. Reporting officer Tom
FEB 15TH 1988
(a) A house in Ngong was burnt by an irate wife. - Reporting
(b) One person died in a head on collision at Dagoreti corner. (c) A BMW 520i was stolen at pangani at gun point. - Reporting

officer Peter
Reporting Officer John.
officer John.

March 20th 1988


UNTRUST BANK in majengo robbed off 2 million - Reporting officer Lucy
Three people ware hurt in a head on collision between two Nissan Matatus at Dagoreti. - Reporting officer Tom
After stealing KAB 932c mazda from Buru Buru, the three robbers broke into a shop in pangani where they
escaped with 300,000.00, But unfortunately they died after a head on collision with a lorry carrying Building
stones in Ngong. - Reporting officer Peter
APR 20TH 1988
An irate maid stole 1,000 from her employer after which she set the house on fire in buruburu. - Reporting
officer John
Ten people died after a mixing machine exploded at dagoreti market. While in a separate incident a striking
worker set an industry a blaze since his colleagues refused to co operate. - Reporting officer Tom
All the reports fall under either of the following categories-:
Car theft Code CT
Arson Code AR
Robbery Code RB
Car accident Code CA
(1) The OCPD has asked you to create a suitable database that will store ( out of the reports) information on
dares, Category code, reporting officer and area only. This is so that they can tell frequently of reports with the
areas.
Print the data base and its structure. ( 40 Marks)
(2) Print out a listing of all records in order of Area and a
another list in order of reporting officers. ( 10
Marks)
(3) Due to departmental reorganization, the following changes are to be implemented from tomorrow.
Officer John will be assigned all past CT Cases
" " Peter " " " " " AR "
" " Tom " " " " " RB "
" " Lucy " " " " " CA "

Amend your records duty ( 10 Marks )


(4) The accountants also want the following included in the data
All CT Cases cost the station Ksh 5,000 to solve
" AR " " " " " 2,000 "
" RB " " " " " 8,000 "
" CA " " " " " 6,000 " ( 10 Marks)

base for easy annual budget.

(5) A National day is on next mont. The superiors would like to


know and merit the most hard working
officers. To facilitate this, prepare a report that will show dates, Area and costs
for all cases, grouped by
officer. (20 Marks)
(6) Officer John was killed in the line of duty. He is to be
replaced Magnum, while officer Tom has been
transferred to
Kamukunji police station. All the cases he handled will now
be handled at Kamukunji
police station amend your records. (
10 Marks)
-Use task2
(A) Create a sort file called RALSORT and sort on overall positions in ascending order.
Get a Printout of the following competitive cars
-Toyotas and Subarus
-Get a printout of all cars that finished rallying.
- Get a print out of all cars that were retired.
- " "
"
" Time barred
(B) Create a sorted file on cars, use an appropriate name
(carsort preferable) and get the printout.
Design a report using a printer spacing chart. The report should contain a page number, date and report column
headings. Group the Cars as per their make. The report heading should be TRUST
BANK SAFARI RALLY `93
By (your name).
Use task3
4.(i)Sum the Quantity field to determine the number of products on hand.
(ii). Average the cost field to determine the Average Cost of the Software.
5.(i) Sort the records (call it sort) stored in the software
Inventory database in ascending order.
(ii) Use SortI to print Software, Category Quantity & Cost.
6. Design the report.
The report should contain a page number, date and report column heading including this fields:-Software home.
-Category.
-Company.
-Quantity.
-Cost and Total.
-Inventory Value.
-Calculate Total Inventory Value by Multiplying Cost x Quantity. Display A
Final total of the Total Inventory Value'
- Print the report.
Use task1
Determine the average cost for all types of music
3 Refer to the memo bellow:M U S I C L I B R A R Y
M E M O R AN D AM
FROM: Library manager

TO : Database Dept
sort the records stored in the music library database in alphabetical order by Artist and use an appropriate
name sorted file {MUSICSOT preferable}
Get a printout of the sorted file
Design the report using a printer spacing chart.
The report should contain the a page number Date(Todays) and report column headings. Display a final total
of the costs. Use a sorted database.
Print the report.
Modify the report format so that a subtotal is taken when there is a change in category.

foxpro exercise
Use task 2. Create labels to sent to all the participants who
finished the rally. The labels should include;
-The name of the rally driver and his co-driver
-The final finishing position
-The number of the car which they where driving.
DOT PROMPT COMMANDS
The dot prompt is a powerful way of communicating with foxpro as it reduces the execution time considerably.
PARADIGM TERMS AND SYMBOLS
[] - Square brackets indicate an optional item, keyword, or clause in a command or function.
<> - angle brackets indicate you must substitute an item of the type requested inside the brackets.
/ - a forward slash indicates you can use one option or the other, but not both.
PICTURE - An option used to restrict the type of data that may be entered into a variable, or to format the
result of an expression.
FUNCTION one of a set of formatting rules that apply to all characters of data displayed by either the SAY
option or the GET option. e.g. !, ^, $ ( A B C D E I J L M R S <n> T X and Z.
TEMPLATE one of the formatting symbols used with the PICTURE key word. These symbols apply to single
characters of data displayed by either the SAY option or the GET option of the @ command.
The templates are ! # $ * , . 9 a l n s and x.

COMMANDS
?/?? [<EXPRESSION 1> displays the value of one or more
[PICTURE<EXPC>] expressions
[AT <EXPN>]
[STYLE <FONT NUMBER>]]
APPEND [BLANK] - Allows you to add a new record to the end of an active database file.
APPEND FROM <FILENAME> - Copies records from an existing file to the end of the active database file.
ASSIST - gives you access to the dBASE IV control center.
BROWSE - A full screen , menu assisted command for editing and appending records in a database (.dbf) files
and views.
COPY FILE <FILENAME> TO <FILENAME> - Creates a duplicate of any file.
COPY TO <FILENAME> - creates a duplicate of the active file
COPY STRUCTURE TO <FILENAME> - creates a duplicate structure of the active database file.
CREATE <FILENAME> - gives you access to the database design screen.
DELETE [<SCOPE>] [FOR <CONDITION>] - marks records in the active database file for deletion.
EDIT - A full screen command to display or change the contents of a record in an active database file.
ERASE <FILENAME>/ OR DELETE FILE <FILENAME>/? - Erases file from the disk directory.
HELP - A menu driven command that provides information about dBASE IV.
INDEX ON <KEY EXPRESSION> TO
<.NDX FILENAME>
/ TAG <TAGNAME>
[OF <.MDX FILENAME>][<UNIQUE>]
- Creates an index file in which records from a database file are ordered alphabetically, chronologically, or
numerically.
INSERT [BEFORE] [BLANK] - Adds a single new record to the

database file at the current location.

LIST/DISPLAY
[fields] <expression list> [off]
[ <scope>] [for<condition>]
[to printer/to file <filename>]
- used to view the contents a database in an unformatted form.
LIST/DISPLAY STATUS
[TO PRINTER/TO FILE <FILENAME>] - Provides information about the current dBASE IV session.
PACK - Removes all records from a database file that are marked for deletion.
RECALL - Reinstates records marked for deletion in the active database
REINDEX - Rebuilds all active index and multiple index files in the active database file.

RUN/! <DOS COMMAND> - EXECUTES a specified dos command, or any program which can be executed
by dos.
SEEK - searches for the first record in an index file database file with a key that matches a specified
expression.
SKIP - moves the record pointer forwards or backwards.
SORT TO <FILENAME>
ON <FIELD>/[/A][/D]
FOR <CONDITION> - creates a new database file in which the records of the active database are positioned
in the specified order.
SUM [<EXPNLIST>
[TO <MEMVARLIST>
[FOR <CONDITION>] - Totals numeric expressions to memory variables.
USE [ <DATABASE FILENAME>
[IN <WORKAREA NUMBER>]
[[INDEX < .NDX OR .MDX FILENAME>]
[ORDER [TAG] < .NDX FILENAME>
[ALIAS <ALIAS>] - Opens an existing database file and may open .ndx or .mdx files.
ZAP - Removes all records in the active database file.

You might also like