0% found this document useful (0 votes)
83 views7 pages

Activity 18.1

.

Uploaded by

Youssef Salah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views7 pages

Activity 18.1

.

Uploaded by

Youssef Salah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

COMPLETE ICT FOR CAMBRIDGE IGCSE® – 2ND EDITION

Activity 18.1
Locating, opening, and importing data from an existing file
In this activity you will learn how to:
identify the structure of a csv file
import a file in csv file format into database software
change field names and data types
change the structure of a database.
1 Load Microsoft Word and locate and open the file called Employees. This file is a comma separated
variable (.csv) file and a section of it is shown here:


Notice that the first row of the data (which also appears on the next line because it is long) contains
the field names. Each subsequent row represents a record. Notice also that all the data is separated
by commas.
Rather than type all this data into the database, we can create a database using this existing file.
Close the file without saving it and exit Word.

2 Load Microsoft Access and then click on .


Give the database the filename ‘Personnel database’ as shown here:

Click on .
3 Look at the following section of the screen which appears:

Click on the tab.

M

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
As a .csv file is a text file, click on Text file which tells the database you want to import the data from
a text file.
4 The Get External Data window appears. Click on Browse and find the file called Employees. Click on
it and select Open. The file name appears in the window as shown:


The data needs to be imported into a database table. Check that the first item in the list has been
selected and then click on OK.
5 The following window appears:


Check that Delimited has been selected as the data being imported has fields separated by commas
and then click on Next.

 M
2

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
6 The following window appears:


Check that Comma has been selected as the delimiter (i.e. what separates the fields in the file)
and tick the box for ‘First Row Contains Field Names’.
You are now going to check the data types for each of the fields to make sure they have been set up
with the most appropriate data type.
Click on .
7 The following window appears where you can check the field names that have been set up
automatically:

 M
3

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
Here you can make changes to the names of the fields and change the data types. You do this
by clicking on the field name and altering either the field name itself or the data type in the next
column using the drop-down arrow.
Make the following changes:
Change the data type of the field ‘Salary’ to currency.
Change the data type of the field ‘Includes IGCSE Maths’ from Text to Yes/No.
Change the data type of the field ‘Includes IGCSE English’ from Text to Yes/No.
Change the data type of the field ‘Driving licence held’ from Text to Yes/No.
Change the field name ‘Includes IGCSE Maths’ to ‘IGCSE Maths’.
Change the field name ‘Includes IGCSE English’ to ‘IGCSE English’.
After all these changes have been made, click on OK.
8 Notice that the changes have been made in the window shown here:


Click on Next.
A window appears and as there are no changes to be made, click Next again.
9 The following window appears:

 M
4

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
Notice that a new field has appeared in the first column called ID. This is called the Primary Key
and it is created automatically to ensure that there is a unique field for each record (i.e. row
of the table).
We want to choose the field Employee No as the primary key as this is a unique field in this table.
Select Choose my own primary key and use the drop-down arrow to select Employee No.
Click on Next.
10 The following window appears:


Here you give the table a name. The name suggested (i.e. Employees) is fine, so just click
on Finish.
The following screen appears:


Click on Close to complete the import of the file to create a table of a database.

 M

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
You will see the table listed on the left of the screen like this:


To open the table, double-click on it and the table is displayed.
The data is shown in Datasheet view and data can be changed in the table in this view.
Notice that the data for the fields IGCSE Maths, IGCSE English, and Driving licence appears as 0
and –1 so this will need to be altered in the next step.
In order to change the structure of the table you need to change the view to Design View.
11 You are now going to change the structure of the table.

Click on and then on and you will switch to Design View which shows the fields
and their data types like this:


Click on the Data Type for IGCSE Maths like this:


Now look at the Field Properties section:


Click on the box to the right of ‘Format’ and you will see a drop-down arrow from which you should
select Yes/No.
Make similar changes to the following fields:
IGCSE English
Driving licence held.

 M
6

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute
In the original CSV file, the Salary field contained numbers so there was no currency symbol added.
To add the currency symbol click on Salary in the list of fields and then click on format and use
the drop-down arrow to move to the required currency. Change the currency to Euro.
Currencies are normally expressed to two decimal places. As salaries are normally given as integers
(i.e. whole numbers) we need to change this so that numbers are given to 0 decimal places. Click
on Salary in the list of fields and then click on decimal places and use the drop-down arrow to
select 0 decimal places.

Click on and then to view the data after the changes have been made.
You will now see the following box appear:


Click on Yes to save the changes made and the table containing the data will be displayed. Notice
that the Yes/No fields are now showing the data correctly and the salary is given in Euros and as
an integer.

You can now close the database.

© OUP 2015: this may be reproduced for class use solely for the purchaser’s institute

You might also like