Top Banner
Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6
36

Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Jan 02, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical Outcomes

IT Key Ideas, Dynamic Database Systems, 2002

IT Key Ideas, Dynamic Database Systems, 2002

Chapter 6

Page 2: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

ReviewReview

IT Key Ideas, Dynamic Database Systems, 2002

A find locates a particular piece of data in order to answer a specific question about the one person (entity). For example, what is Bonny Jane’s surname?

page 65

Page 3: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

A query, eg. how many people have brown hair?locates many records that match the specified criteria.

Even while there are many records, there is nevertheless one answer.

Even if the wording is changed tolist the people have brown hairthe list is but one answer.

Page 4: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

# records

Page 5: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

Consider these outcomes

Each question will have many answers. The last question will have many lists, i.e. many answers.

How many people have each colour of hair? or

How many people are there per age? or

For each favourite TV programme, list the names of the people.

Page 6: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

Statistical Outcome

by using a Query with Total

Page 7: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical Outcome

Report,with groupsand summaries

Page 8: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

Statistical OutcomesStatistical Outcomes

The critical word that leads to the production of many answers is each or per.

How many people have each colour of hair? or

How many people are there per age?

Page 9: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical outputs are achieved by activating Total, which adds a new line to the QBE grid.

IT Key Ideas, Dynamic Database Systems, 2002

Page 10: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical CommandsCommand Explanation

Group By organises or sorts records into groups

Count counts the number of records

Where a specified criteria has to be met

Sum calculates a total value (for each group)

Avg calculates average values

Min determines the smallest values

Max determines the largest values

First determines the first value

Last determines the last value

StDev calculates the standard deviation

Var calculates the variance

Expression to create specific calculations

page 66

Page 11: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

Example

To achieve this in a room of people one would organise groups of people into different corners of the room according to their hair colour and then manually count the number of people in each group.

How many people have each different hair colour?

page 66

Page 12: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

# people each hair colour

IT Key Ideas, Dynamic Database Systems, 2002

The elements of data required to achieve this output are

Hair Colour and Surname.

The Hair Colours are grouped and the Surnames are counted.

Hair Colour Surname

GroupBy Count

Page 13: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Output

IT Key Ideas, Dynamic Database Systems, 2002

Page 14: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

NB:

IT Key Ideas, Dynamic Database Systems, 2002

Different fields can be used as the counting field, rather than Surname, without affecting the output.

Page 15: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical Queries

Practical 6.1page 67

IT Key Ideas, Dynamic Database Systems, 2002

Page 16: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

If a little unsure, work out the output. Make a mock list of what you expect the result to look like.

Example – This week’s pay for each employee

Hint

Sydney Daw $226Mahlah Illman $266Zo Treadwell $263Kathleen Anderson $297Desmond Fekete $237Judith Offler $214Jarrod Manuel $212Elvin Braine $305Derek Empson $330Gerda Tayler $224

Page 17: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people for each Age

IT Key Ideas, Dynamic Database Systems, 2002

The word age follows the term each, then it is Age that needs to be placed in groups. To determine the number of people, count the Surnames.

page 68

Age: Surname

GroupBy Count

Age: Int((Date()-[Date of Birth])/365.2425)

Page 18: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Dates of birth of the eldest personfor each different eye colour

IT Key Ideas, Dynamic Database Systems, 2002

The grouping field is Eye Colour.

NB: Dates are stored as numbers from 1/1/11900.

The older a person is the smaller the number stored in the Date of Birth field => Min is the appropriate statistical command.

Page 19: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Formatting

Field Format

Date of Birth dddd, d\ mmmm\ yyyy (amongst other variations)

Average age Fixed, 2 decimal places

Phone number @@@@\ @@@@ (if stored as text)

IT Key Ideas, Dynamic Database Systems, 2002

Page 20: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Average age of males and females

IT Key Ideas, Dynamic Database Systems, 2002

The groups are the males and females, hence GroupBy Sex.

The average age specifies the Avg command.

Page 21: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people for each Age

IT Key Ideas, Dynamic Database Systems, 2002

The word age follows the term each, then it is Age that needs to be placed in groups. To determine the number of people, count the Surnames.

Page 22: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people per hair colour per eye colour

IT Key Ideas, Dynamic Database Systems, 2002

The double per indicates a double grouping.The order of implementation of such a question is often virtually backward; i.e.

Group By Eye ColourGroup By Hair ColourCount Surname

page 69

Page 23: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Statistical Outcomes with criteria

Criteria can be applied to Statistical Outcomes, just as with standard Queries. Indeed, in a real-life system, one is unlikely to produce statistics of the whole set of data.

IT Key Ideas, Dynamic Database Systems, 2002

Page 24: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people per eye colour, who are at least 50 years of age

IT Key Ideas, Dynamic Database Systems, 2002

This query involves setting a criterion of at least 50 for the Age field. This is accomplished by using the Where command on the Total line.

Grouping the Eye ColourCounting the SurnamesWhere the Age is >=50

Page 25: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

page 69

Page 26: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

SQL, for statistical outcomes

SELECT [Eye Colour], Count (Surname) as CountFROM DetailsWHERE Int((Date()-[Date of Birth]) /365.2425)>=50GROUP BY [Eye Colour];

Page 27: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of blonde females per age

IT Key Ideas, Dynamic Database Systems, 2002

Set Hair Colour to Blonde andSex to fGrouping the AgeCounting the Surname

page 69

Page 28: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of male and female adults with brownish hair

IT Key Ideas, Dynamic Database Systems, 2002

Set Age to >= 18 andHair Colour to *brownGrouping SexCounting Surname

Page 29: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people in each generation

IT Key Ideas, Dynamic Database Systems, 2002

Group By GenerationCount Surname

comes readily to mind

But how is Generation obtained?It is similar and connected to Age, but how is it related?A comparison between Ages and Generations may help.

Page 30: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people in each generation

IT Key Ideas, Dynamic Database Systems, 2002

Age Generation Age Generation Age Generation Age Generation

10 10s 20 20s 30 30s 40 40s11 10s 21 20s 31 30s 41 40s12 10s 22 20s 32 30s 42 40s13 10s 23 20s 33 30s 43 40s14 10s 24 20s 34 30s 44 40s15 10s 25 20s 35 30s 45 40s16 10s 26 20s 36 30s 46 40s17 10s 27 20s 37 30s 47 40s18 10s 28 20s 38 30s 48 40s19 10s 29 20s 39 30s 49 40s

Page 31: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

The number of people in each generation

IT Key Ideas, Dynamic Database Systems, 2002

The connection between Age and Generation is a span of ten years,

10-19 is the 10s

20-29 is the 20s and so on.

The Generations can be generated either arithmetically or by using text functions as the first digit is the same.

Page 32: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

Pick any age between 20 and 29,

for example 27

divide by 10

2.7

remove the decimal component

2

multiply the age by 10

20

add the s to the characters

Arithmetically

Page 33: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

IT Key Ideas, Dynamic Database Systems, 2002

take the first character of the age,

for example with 27

2

add the characters 0s

20s

Text based

Page 34: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Homework/Study

Exercise 6.2page 71-73

IT Key Ideas, Dynamic Database Systems, 2002

table of data page 72

Data File People&Hobbies

Page 35: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Practical 6.3page 74

IT Key Ideas, Dynamic Database Systems, 2002

Data File Class Details

Page 36: Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6.

Chapter 6Chapter 6

********************************