Lesson Objectives By the end of the lesson you will be able to: Create queries using logical operators Create queries using a range of criteria Use wildcard searches within a query
Task 1 – Logical Operators We can use logical operators in the criteria field. Operator Meaning AND Both conditions are true OR One condition is true NOT The condition is not true Create a query to test out these logical operators and explain their meaning in your book. >01/03/2012 AND <10/03/2012 01/03/2012 OR 10/03/2012 3. NOT 10/03/2012 Make a Note.
Task 1 Continued… Create a query that list students in HA1 OR HA2 Create a query that list students NOT in HA6 Create a query that list students in HA5 OR HA7 For each one write a sentence in your book to explain what each query does.
Task 2 – That’s Long... Create a query for the following: Students: Who have an allergy Who have paid more than a £5.00 deposit Are not in HA1 Finish by sorting them into alphabetical order by their surname
Wildcard Searches – * The queries we have completed so far require us to type in the exact criteria we are searching for… Example: Mobile Number: 09504 652 123. We don’t always have all the search criteria we need to find the required information… We can use a wildcard (*) search where we are only required to enter part of the criteria. For example 0771* will find all records which contain a mobile number starting with 0771.
Task 3 – Wildcard Searches Open up the New School Trip database you used last lesson and create a query as follows: Add all the fields Enter the criteria 0771* in the Search Criteria for Number Run it and see what the result is… Edit the query by changing the criteria to find records for those people who have: Address Line 2 starting with a G Surname ending with an E Address Line 2 having the word New in it - enter *New*
Notes Time! (*) Means “anything”. A* would find everything beginning with an A. *S would find everything ending in an S. *ABC* would find everything with the letters ABC appearing anywhere in the field.
Plenary – Hands Up and Self Review What do AND, NOT and OR mean? What symbol does a wildcard search require? How can you search for people who’s surname contains the letters ‘ith’ at the end? In your book write down: 3 concepts/skills to do with creating queries you are confident with 2 things you need to go over again