大象传媒

Testing and evaluationExample

A database is fit for purpose if it meets the end use and functional requirements. Testing queries and examining actual output against expected output helps to determine fitness for purpose.

Part of Computing ScienceDatabase design and development

Example

A list of all pupils grouped by their pastoral care teacher and ordered by merit points. The list should be ordered by the merit points in descending order.

When we are testing, we should follow a set of stages:

  • design
  • implementation
  • testing: predicted result and actual result

Design

Query Design: Return a list of all pupils grouped by their pastoral care teacher and ordered by their merits points in descending order

Field(s)First Name, Surname, Pastoral Care Teacher, Merit Points
Table(s)Pupil
CriteriaGROUP BY Pastoral Care Teacher
Sort OrderMerit Points DESC
Field(s)
First Name, Surname, Pastoral Care Teacher, Merit Points
Table(s)
Pupil
Criteria
GROUP BY Pastoral Care Teacher
Sort Order
Merit Points DESC

Implementation

SELECT firstname, surname, pastoralCareTeacher, meritPoints
FROM Pupil
ORDER BY meritPoints DESC
GROUP BY pastoralCareTeacher;

Testing

Predicted result

The predicted result shows what the developer expects the query to return.

PupilIDFirst NameSurnameClassPastoral Care TeacherMerit Points
0010ThomasGlacney1M1Miss Armstrong91
0011FrankieAl-Robeye1M2Mr Gilchrist71
0003AmyJones1M1Mr Gilchrist55
0006AntoniaGallagher1M2Mr Gilchrist21
0004JamesMcNamee1T1Mr Harley88
0009BeatricePanner1T2Mr Harley77
0001ZainabSingh1T1Mr Harley74
0007AmyMcNamee1T1Mr Harley63
0008AyshaMatazinadze1T1Mr Harley45
0005PawelMcTavish1I1Mrs Aitken19
0002DavidBoland1I2Mrs Aitken12
PupilID0010
First NameThomas
SurnameGlacney
Class1M1
Pastoral Care TeacherMiss Armstrong
Merit Points91
PupilID0011
First NameFrankie
SurnameAl-Robeye
Class1M2
Pastoral Care TeacherMr Gilchrist
Merit Points71
PupilID0003
First NameAmy
SurnameJones
Class1M1
Pastoral Care TeacherMr Gilchrist
Merit Points55
PupilID0006
First NameAntonia
SurnameGallagher
Class1M2
Pastoral Care TeacherMr Gilchrist
Merit Points21
PupilID0004
First NameJames
SurnameMcNamee
Class1T1
Pastoral Care TeacherMr Harley
Merit Points88
PupilID0009
First NameBeatrice
SurnamePanner
Class1T2
Pastoral Care TeacherMr Harley
Merit Points77
PupilID0001
First NameZainab
SurnameSingh
Class1T1
Pastoral Care TeacherMr Harley
Merit Points74
PupilID0007
First NameAmy
SurnameMcNamee
Class1T1
Pastoral Care TeacherMr Harley
Merit Points63
PupilID0008
First NameAysha
SurnameMatazinadze
Class1T1
Pastoral Care TeacherMr Harley
Merit Points45
PupilID0005
First NamePawel
SurnameMcTavish
Class1I1
Pastoral Care TeacherMrs Aitken
Merit Points19
PupilID0002
First NameDavid
SurnameBoland
Class1I2
Pastoral Care TeacherMrs Aitken
Merit Points12

Actual result

The actual result of the query is then recorded. It can be compared to the expected result to make sure that the query has executed as expected.

SQL has encountered a Syntax Error at line 4 (GROUP BY pastoralCareTeacher)