☰ Year plan · Communication Technology

Forms and queries

Week 13 · Lesson 9 Forms and Queries · 3 lessons
3

Criteria and hidden fields: sharpening the question

ICT Prep 1 Term 1, Lesson 9: pp. 87–97
GoalSharpen a question with criteria and hidden fields, and say why hidden is not deleted.
New words
criterion · one condition, such as “Class is 1A” or “English is more than 13”hidden field · a field that the query uses but does not show in the resultmore than · a comparison: 15 is more than 13, but 12 is notboth conditions · a record must meet every criterion in the grid to appear
Explanation

We can sharpen a question by adding criteria. If we put a criterion in two fields, a record must meet both of them to appear. Take the question “Which pupils are in class 1A and have an English mark of more than 13?” The criterion for Class is 1A, and the criterion for English is more than 13. Mina is in 1A with 15, so she appears. Omar is in 1A but has 12, so he does not. Salma has 17 but is in 1B, so she does not either. The result is only Mina. We can also hide fields. If we use the English field only for the criterion, we remove the tick from its Show row, and the answer shows just the names. Hidden does not mean deleted: the field is still in the table, and the query just does not display it. Try it next with another invented question.

FieldNameClassEnglish
TablePupilsPupilsPupils
Showyesyesno
Criteria1A>13
Worked examples
ABCD
1idNameClassEnglish
21Mina1A15
32Salma1B17
43Omar1A12
54Nour1C19
65Youssef1B14
Which pupils have an English mark of more than 14? Check each mark: 15 yes, 17 yes, 12 no, 19 yes, 14 no (14 is not more than 14). The result is Mina, Salma and Nour: three records.
A
1Name
2Salma
Which pupils are in class 1B with English of more than 15? Salma has 1B and 17, so she appears. Youssef has 1B but 14, so he does not. The result: Salma only.
After we hide the English field in the answer, the result shows only names. We open the table and the English marks are still there, so hidden is not deleted.
Class activity

Make six invented pupil cards with a class and a mark. Write two queries, each with two criteria, and find the result by sorting the cards. Then say which field you would hide in the answer, and prove to a partner that the hidden data is still on the card.

Practice
1
English marks: 15, 17, 12, 19, 14. Which are more than 14?
2
When there are criteria in two fields, what must a record do to appear?
3
How do we hide a field in the answer, and is its data deleted?
4
Which pupils are in class 1A with English of more than 13?