![]() |
Exploring Data Analysis |
|
Combinations of Operations |
|
Overview |
|
To further enhance your filtering capabilities, you can use Boolean algebra combined with the operators we have used so far. Besides the logical operators we know already, Boolean algebra adds extra operators used to concatenate expressions. Boolean Algebra works on logical statements. A statement is a sentence |
![]() |
|
|
|
Logical Conjunction: The And Operator |
|
Imagine that you are reviewing the students’ records of a school and you want to make sure that you know whom to contact in case of emergency for each student. For example, imagine that you are trying to make sure the record of each student provides an emergency telephone number. The statement to evaluate would be:
If the record of the student referred to contains an emergency phone number, the statement is true. If the record does not provide this information, our goal is not met and the statement is false. Imagine that, on the other hand, we want to find out if the record of each student displays the name to contact in case of emergency. The statement considered would be:
If the record considered displays an emergency name, the statement is true. Imagine that a student's record indicates an emergency telephone number but does not provide an emergency name. What if a student's record indicates an emergency name but no emergency telephone number? It appears that in the absence of one of these pieces of information, it would be hard to perform an effective contact. To make a record complete or to accomplish our goal, we want each record to have both an emergency name and an emergency telephone number. We can combine both of the above statements as follows:
Evaluating the combined statement would produce the following results:
To resume, our goal is met only if BOTH the first and the second statement are TRUE. |
|
|
|
|
Logical Disjunction: The OR Operator |
|
Imagine that our main goal is to make sure that we have a number we can use to contact somebody for the student. In this case, either the home phone number or the emergency number would be fine. We already have the following two statements:
To get either number, we can concatenate these two statements and evaluate the truthfulness of either one of them. We create a new statement as follows: "This student's record indicates a home phone number" OR "This student's record provides an emergency phone number" The comparative evaluation produces the following results:
The logical disjunction shows us that a combined statement is true if EITHER of its two statements IS TRUE. The logical disjunction produces a false result if BOTH of its two statements are FALSE. |
|
|
|
|
Combination of Logical Operators |
|
You can apply more restrictive filters by combining logical operators, as long as you follow some rules. Imagine that in your database of students, you want to get a list of girls whose records indicate either a home telephone number or an emergency telephone number. On the other hand, imagine that, at your car rental company, a customer wants to rent a small car that has a cassette player. To find these records, you should proceed by logic thinking and combine filters that can produce the right result. Because databases are varied and scenarios are different, there is no strict recipe to follow, just some
suggestions.
Then click the OR tab and proceed the same for both the Gender combo box and the emergency telephone number field:
After applying the filter, you would notice that the list displays only boys whose records have either of both telephone numbers.
|
|
|
|
|
Logical Operators: Between |
|
The Filter By Form feature allows you to filter records by assigning appropriate criteria. The Filter By Form is like a dialog box in the form of a datasheet where you decide how to set the criteria. A technique used to filter records between ranges of values involves the use of the BETWEEN keyword. The Between comparison is usually combined with the AND operator to get a list of records between two values. |
|
|
|
|
Like Wildcards |
|
A wildcard is a character or a group of characters that specify a criterion the database should follow to find records. When performing filtering, wildcards are usually used with the LIKE operator. |
|
|
|
|
MOUS Topics |
| S28 | Apply and remove filters (filter by form and filter by selection) |
| S29 | Specify criteria in a query |
|
|
||
| Previous | Copyright © 2002-2004 FunctionX, Inc. | Next |
|
|
||