Operators and Wildcards
Learning intentions We are: Revising previous learning on Database Queries Using Mathematical Operators within queries Learning about Wildcards and when its appropriate to use these
Learning intentions We are also Learning about queries that include: AND, OR, NOT, BETWEEN, NULL, IS NOT NULL
Success criteria You will successfully be able to conduct queries to search the database and know how to print these You will have developed your knowledge of queries and your ways of searching will be more sophisticated, and therefore you will be more productive
Success criteria You will successfully be able to conduct sorts to order the results you have found Sorts on one field Sorts on 2 fields
When you search a database using a query you can search for a very specific criteria in a specific field to find related results to do this you would enter this specific criteria in the criteria box under the field heading within the query.
To refine your query, You can also search on more than one field at a time. This will narrow down the results that are given.
Mathematical Operators One or more words Mathematical Operators Wildcards Or And Not Between Is Null Is Not Null Criteria
Mathematical operators > >= < <= = <>
wildcards Character Description Example * Matches any number of characters. You can use the asterisk (*) anywhere in a character string. wh* finds what, white, and why, but not awhile or watch. ? Matches a single alphabet in a specific position. b?ll finds ball, bell, and bill. [ ] Matches characters within the brackets. b[ae]ll finds ball and bell, but not bill. ! Excludes characters inside the brackets. b[!ae]ll finds bill and bull, but not ball or bell. Like “[!a]*” finds all items that do not begin with the letter a. - Matches a range of characters. Remember to specify the characters in ascending order (A to Z, not Z to A). b[a-c]d finds bad, bbd, and bcd. # Matches any single numeric character. 1#3 finds 103, 113, and 123.
wildcards Whilst its good to have a knowledge of all available wildcards, we will mostly use the * wildcard.
Queries can also so used to sort the results on one or more field. sorting Queries can also so used to sort the results on one or more field. Field headings must be entered into the query in the order that they have to be sorted. For example, in a sort by SURNAME and CLASS, you would need to ensure that SURNAME is entered in the query first. This would ensure you get the correct order.
Sorting – ASCENDING ORDER Ascending Order sorts alphabetically A>Z Ascending Order also sorts numerically, smallest to largest Ascending Order also sorts chronologically, first to last
Sorting – DESCENDING ORDER Descending Order sorts alphabetically Z>A Descending Order also sorts numerically, largest to smallest Descending Order also sorts chronologically, last to first
Printing results of queries Results of queries can be printed by copy and pasting the results to a Word document Its better if you print them in a database report, demonstrating your knowledge of reports. You may have to include your query results in a business letter or in a Powerpoint presentation, so in this case your would simply open the document and paste the query results in the relevant place.
Worked examples