Year 11 Computing — Asking a database a question
Read a query as three separate decisions — which fields, which records, in what order — and work out how much comes back.
Name: ________________________
1.A query gives back six records and orders them by mark, largest first. The six marks are 44, 91, 67, 91, 30 and 55. What is the mark in the third row of the answer?
2.The answer to a query comes back as twelve rows of four columns. How many single values are in that answer?
3.A table holds five records whose marks are 40, 75, 62, 88 and 51. Match each condition to how many rows a query using it gives back.
- WHERE marks > 60
- WHERE marks > 80
- WHERE marks < 55
- WHERE marks > 30
- WHERE marks >= 51
- 3
- 4
- 1
- 5
- 2
4.A table holds fifty records. A query asks for the records where the mark is more than 60, and eighteen of the records have a mark like that. How many rows does the query give back?
5.A query asks for the records with a mark of more than 100, over a table whose largest mark is 98. How many rows does it give back?
6.A table holds forty records. Twenty-five have a mark over 60, thirty are in the swimming team, and twenty are both. How many records satisfy "mark over 60 OR in the swimming team"?
7.What does the WHERE part of a query decide?
- a) Which records come back
- b) The order the records come back in
- c) Which fields come back
- d) Which table is looked in
8.A table holds seven records whose marks are 12, 48, 65, 90, 33, 71 and 55. Put these conditions in order of how many rows a query using each one gives back, fewest first.
- WHERE marks > 70
- WHERE marks > 85
- WHERE marks > 60
- WHERE marks > 40
Answer key — Year 11 Computing — Asking a database a question
- 1. 67
- 2. 48
- 3. WHERE marks > 60 → 3; WHERE marks > 80 → 1; WHERE marks < 55 → 2; WHERE marks > 30 → 5; WHERE marks >= 51 → 4
- 4. 18
- 5. 0
- 6. 35
- 7. a) Which records come back
- 8. 1. WHERE marks > 85 2. WHERE marks > 70 3. WHERE marks > 60 4. WHERE marks > 40