6. MICROSOFT ACCESS QUERIES – ADVANCED
6.1: Logical Expressions
Sometimes we need to retrieve data based on multiple criteria which are expressed as logical expressions involving the logical operators and, or, and not. For example, a student using the University database might want to know which courses offered by the Chemistry and Physics departments are not full courses (that is, they are not 6 credit hour courses). The criteria can be restated with emphasis on logical operators:
-
-
- a course is a Chemistry course or a course is a Physics course,
-
and
-
-
- the course has any value for credit hours but not 6.
-
Such criteria involves and, or, and not. Stating the requirements in natural language may seem easy, but stating these properly in the forms-based Query By Example design window requires specialized knowledge.
MS Access provides a way for us to specify the above using the Criteria and Or lines in the Grid. We will consider each of the operators And, Or, and Not.