Statistical Outcomes IT Key Ideas, Dynamic Database Systems, 2002 Chapter 6
Review 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
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 to list the people have brown hair the list is but one answer.
IT Key Ideas, Dynamic Database Systems, 2002 # records
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.
IT Key Ideas, Dynamic Database Systems, 2002 Statistical Outcome by using a Query with Total
Statistical Outcome Report, with groups and summaries
IT Key Ideas, Dynamic Database Systems, 2002 Statistical 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?
Statistical outputs are achieved by activating Total, which adds a new line to the QBE grid. IT Key Ideas, Dynamic Database Systems, 2002
Statistical Commands page 66
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
# 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 ColourSurname GroupByCount
Output IT Key Ideas, Dynamic Database Systems, 2002
NB: IT Key Ideas, Dynamic Database Systems, 2002 Different fields can be used as the counting field, rather than Surname, without affecting the output.
Statistical Queries Practical 6.1page 67 IT Key Ideas, Dynamic Database Systems, 2002
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
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 GroupByCount Age: Int((Date()-[Date of Birth])/ )
Dates of birth of the eldest person for 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/ The older a person is the smaller the number stored in the Date of Birth field => Min is the appropriate statistical command.
Formatting FieldFormat 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
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.
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.
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 Colour Group By Hair Colour CountSurname page 69
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
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 Colour Counting the Surnames Where the Age is >=50
IT Key Ideas, Dynamic Database Systems, 2002 page 69
SQL, for statistical outcomes SELECT [Eye Colour], Count (Surname) as Count FROM Details WHERE Int((Date()-[Date of Birth]) / )>=50 GROUP BY [Eye Colour];
The number of blonde females per age IT Key Ideas, Dynamic Database Systems, 2002 Set Hair Colour to Blonde and Sex to f Grouping the Age Counting the Surname page 69
The number of male and female adults with brownish hair IT Key Ideas, Dynamic Database Systems, 2002 Set Age to >= 18 and Hair Colour to *brown Grouping Sex Counting Surname
The number of people in each generation IT Key Ideas, Dynamic Database Systems, 2002 Group By Generation Count 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.
The number of people in each generation IT Key Ideas, Dynamic Database Systems, 2002
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, is the 10s 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.
IT Key Ideas, Dynamic Database Systems, 2002 Pick any age between 20 and 29, for example 27 divide by remove the decimal component 2 multiply the age by add the s to the characters Arithmetically
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
Homework/Study Exercise 6.2page IT Key Ideas, Dynamic Database Systems, 2002 table of data page 72 Data FilePeople&Hobbies
Practical 6.3 page 74 IT Key Ideas, Dynamic Database Systems, 2002 Data File Class Details
Chapter 6 ********************************