4.5: And

Suppose we want to list Celko’s books on SQL. In this case there are two criteria a book must meet:

      • Criteria 1: the author’s name must end with “Celko”
      • Criteria 2: “SQL” must appear in the title.

Criteria 1 must be true and Criteria 2 must be true – we say the two criteria are anded. When using QBE we must place these two criteria on the same criteria line in order that MS Access finds rows that match both criteria.

In this example we are looking for titles that have the text SQL anywhere within the title. MS Access provides a way for us to define such a pattern. The character * when used in a text string is a wildcard character that matches any number (zero or more) of characters. For Criteria 1 we use the Like operator, and we need two wildcards so we specify the pattern that title must match: Like “*SQL*”.

For Criteria 2 we specify the pattern that author must match: Like “*Celko.


Figure 4.13: Criteria on one criteria line are ANDed


Share This Book