You are on page 1of 5

Bunat Al Ghad Academy

A level IT-Topic 10
Criteria for queries

Criteria for Example : for a field like sold : Yes, No


Boolean field
Example:
 Less than 30 : <30

Criteria for  Greater than 30: >30


numeric field  Greater than or equal to 30 : >=30
 Less than or equal to 30 : <=30
 Does not equal 30 : <>30 (not 30)
 Between 30 and 40 (30 and 40 will be included) :
between 30 and 40
 Between 30 and 40 (30 and 40 excluded) : >30 and<40.
 Greater than or equal 30 and less than 40 : >=30 and <40.

 Made in 1998 :
criteria for
date field >=1/1/1998 and <=31/12/1998.
 Made before 1998: <1/1/1998
 Made after 1998: >=1/1/1998
 Between two dates:
between 28/3/2012 and 2/3/2013.
Use wild cards (*,?)
Criteria for text Contains the word file: *file*
field Begins with the letters Pc: Pc*
Ends with the letters Pc: *Pc
Code is CR or CP: CR or CP.
Country is spain: spain.

? Replaces 1 character.
Bunat Al Ghad Academy
A level IT-Topic 10
Criteria for queries

Sp??n( the result will be all records with 5 characters, begins


with sp ends with n).
Static parameters :
All the of the above are static criteria where Parameters(values used within the
criteria will not change each time the query is run
Query parameters is fixed.
Cross-tab A crosstab query calculates a sum, average, or other aggregate
query-Pivot function, and then groups the results by two sets of values
table — one down the side of the datasheet and the other across
the top.

Summary
query We want to find the
total number we've
sold of each of our
menu items.

Dynamic query
(parameters)
Bunat Al Ghad Academy
A level IT-Topic 10
Criteria for queries
Bunat Al Ghad Academy
A level IT-Topic 10
Criteria for queries

 Evaluate the use of static and dynamic parameters in query and when they should be
used
Static parameter query: Parameters (values used within the criteria will
not change each time the query is run, hard-coded into the
application.

In a static query every time that the query is run it will search for the
same data.
If different data is to be searched for the user would need to open up
the query in design view and change the data in the criteria to that
required.

Dynamic parameter query: allow parameters to be chosen at the


time of running the query, this is useful when the user needs to
decide what parameters to enter, not hard-coded into the
application.
Every time the query is run a dialogue box would appear asking the
user to type in different parameters.
This would save the time of designing the query every time the user
wants to search for a new criteria.

 Analyse when simple, complex, nested and summary queries (including


cross-tab queries/pivot tables) should be used

A simple query searches on a single criterion, such as gender=Male

A complex query searches using multiple criteria, gender=Male and country=


Jordan.

Nested queries - A nested query is a query within another query. A subquery is


used to return data that will be used in the main query as a condition to further
restrict the data to be retrieved.
Used when nesting the queries easier to understand.
Bunat Al Ghad Academy
A level IT-Topic 10
Criteria for queries

A summary query such as a crosstab query calculates a sum, average, or other


aggregate function, and then groups the results by two sets of values— one
down the side of the datasheet and the other across the top.

You might also like