lecture roger sutton [email protected] 14: data management facilities 1

16
Lecture Roger Sutton [email protected] 14: Data Management Facilities 1

Upload: marjory-young

Post on 24-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

1

Lecture

Roger Sutton [email protected]

14: Data Management Facilities

CO357 Computing for Business and Accounting

Database Facilities

Example of a simple database:

Record There is an entry for each order. Each entry is called a record and takes up a row

Field Each record contains the same 5 fields. The first row of the database contains the field names, the other rows contain the actual data - the field values

2

CO357 Computing for Business and Accounting

Database Facilities -cont’d

Excel is primarily a spreadsheet so does not offer all the features of special purpose database management system (DBMS). It will, however, allow straightforward tasks to be perform such as:

finding individual records adding new records editing existing records deleting records

3

Other more complex tasks such as sorting or extracting recordsthat meet a specific criterion are also possible.In Excel:

A database cannot not occupy more than on worksheet, A database may contain up to 16,383 records. A database may contain up to 256 fields. The first row must contain the field names.

CO357 Computing for Business and Accounting

Building the database

It is essential to plan the structure of the database before you create it.Decide what data is to be stored and how: - this means decide

i what fields are required and their name, i the data-type of each field, i its maximum size of each field,i the format of the field.

Accordingly the field names are entered in the first row and the cells below formatted appropriately.Note:

i New fields can be added later simply by introducing additional field names.

i Some field values may be derived from others by entering the appropriate formula.

4

CO357 Computing for Business and Accounting

Sorting

This can be applied to any range of worksheet cells and acts on ‘numbers’ before ‘text’.Records are rearranged in a different sequence according to value of a specified sort key.To sort the example database

i Select the whole database including the field names, A1:E11i Make cell A1 active and press Ctrl+Shift+* to select the database

‘block’ (Heading row and following records).i Use Data |Sort to obtain the Sort dialog boxi Complete the dialog box, E.g.

1. Click the down arrow of Sort by and select Order date2. Leave ascending button on (Earliest date first)3. Ignore the next two boxes4. Leave Header Row selected so that the field names are not included in

the sort

5

CO357 Computing for Business and Accounting

Sorting – cont’d

E.g.

6

co357lec09

CO357 Computing for Business and Accounting

Sub-totalling

Often, having grouped records, it is required to sum some numerical entries within the group. To achieve this, it is necessary:• to sort the records into the categories to be sub-totalled• select the range of data• Use Data |Subtotal from Outline to obtain the Subtotals dialog box• Complete the dialog box, E.g.

1. Click the down arrow of At each change in: and select Co. Name

2. Identify Sum for Use Function:3. Tick Value, VAT and Total in

Add subtotal to:Click Remove All to remove the subtotalling.

7

CO357 Computing for Business and Accounting

Sub-totalling – cont’d

8

co357lec09

CO357 Computing for Business and Accounting

Maintenance

Records are added, deleted or amended most easily using a data form. The Form icon will need to be added to the Quick Access Toolbar . This is accomplished within Excel Options | Customise by selecting and then adding the Form icon from All Commands.

9

CO357 Computing for Business and Accounting

Maintenance – cont’d

n Alternatively Criteria may be used to find a record that satisfies certain conditions. FindPrev, FindNext and scroll bars are used to move on or back from the current record.

n The Delete button can be used to delete a whole record.

The form is created by making one of the database cells active, say A2, and clicking the Form icon in the Quick Access Toolbar

i By clicking FindNext or the scroll bar arrow each record may be viewed

10

CO357 Computing for Business and Accounting

Searching

The criteria button of the form allows records to be located according to specified criteria.Enter the value required in the appropriate field box of the Criteria form and click FindNext. E.g. Type ‘Patel’ in Co. Name and click FindNextAdditional criteria can be used by adding more values/conditions to the fields in the criteria form.E.g. Type <1000 in the Value box and click FindNext

Note 1. The first 5 data fields can be edited, but that the calculated fields, VAT and Total cannot be changed and hence are not enclosed in boxes.

2. Changes made to a record using a data form are saved permanently as soon as you move to another record.

The Restore button is used to undo this.

11

CO357 Computing for Business and Accounting

Filtering

The data form has limited search capabilities since it can only display one record at a time and its not possible to specify alternative values or composite conditions.Using Data|Sort & Filter introduces list boxes next to each field name in the database. Each list box contains the values in that particular field. This then allows:

1. Searching by Individual Field Values – deselect ‘Select All’ and select one of the values in the list box, or

2. Searchin on one value and then refining the search - by choosing another value from another list box

Note the full database is retrieved by clicking Filter again or Clear

12

CO357 Computing for Business and Accounting

Advanced Filtering

This facilitates searching using composite conditions.E.g. To extract those order greater than £500 total before 11/03/06.

The field headings are copied to another part of the worksheet and the conditions entered below. If the condition are placed on the same line both are required to be true. If the conditions are on consecutive lines then if either is true the record will be extracted.

13

Click the Advanced filter button to reveal:i The List range identifies the datai The Criteria range indicates where to find

the conditions, and i Copy to indicates where to display the

extracted records

CO357 Computing for Business and Accounting

Pivot Tables

For this PivotTable and PivotChart wizard icon should be added to the Quick Access Toolbar.A PivotTable report is used to summarise large amounts of data quickly.

To create Pivot table:1. Click the PivotTable and PivotChart Wizard icon on the Quick

Access Toolbar.2. In step 1 of the PivotTable and PivotChart Wizard, follow the

instructions, and click PivotTable under What kind of report do you want to create?

3. In step 2 of the wizard identify the data with column headings.4. Decide where table is to be displayed and click Finish.

A table outline appears with the Pivot table dialog box.

14

CO357 Computing for Business and Accounting

Pivot table – cont’d

1. Drag field labels from the field list box on to the column and field label boxes as required.

2. Drag quantitative data field labels into the centre of the table. 3. Format the resulting table as required.

15

CO357 Computing for Business and Accounting

Pivot table – cont’d

To produce:

16

n The summary quantities can be changed by selecting Value Field Settings from the ‘Sum of Total’ pull down list.

co357lec09