|
[Home |
Announcements |
Access |
Installation |
User Notes |
Data Dictionary |
Mailing List |
Contact]
Combining Qualifications (Mixing ANDs and ORs)
When we use both ANDs and ORs in a datawarehouse query, we need to combine our
qualifications to ensure that GQL will return the rows we want. Combining
eliminates ambiguity in a query.
To see why this is important, consider this fanciful selection criteria:
- A grapefruit, or a bagel and cream cheese.
The meaning is clear enough, but consider what happens when we move the comma:
- A grapefruit or a bagel, and cream cheese.
See how the meaning has changed?
If we remove the comma entirely:
- A grapefruit or a bagel and cream cheese.
the meaning of the phrase becomes ambiguous.
It's obvious that the comma serves to help clarify the meaning. In Warehouse
parlance, the comma serves to "combine qualifications." Of course, in the Data
Warehouse we don't use a comma but use the combine qualification feature
instead.
For our data warehouse example, let's say you want to find the number of students enrolled fall 1996
who are majoring or minoring in English. This query will have two ANDs and an OR so you'll need to
combine qualifications.
- Go to the All Terms(2) model.
- Open the Current Students object.
- Select Warehouse ID and in its function box select COUNT.
- Qualify TERM = 199601
- Qualify Hours Registered > 0.
- Qualify All Majors contains |ENG|.
- Qualify All Minors contains |ENG|.
- Click on the 'and' between the All Majors and All Minors qualifications to change it to an 'or'.
(Otherwise you would be trying to count students who are both majoring and minoring in English!)
- Now you need to group the two qualifications that are connected by the 'or'. Click on the grayed
box above the qualification "All Majors Contains |ENG|". The box should darken indicating
that it is now selected. Next, you need to also select the "All Minors Contains |ENG|"
qualification. Hold down the shift key and click on the box above the qualification. (Holding the shift
key down ensures that previously selected qualifications aren't deselected; i.e., it allows you to select
more than one qualification). Both qualifications should now be selected and are ready to be combined.
- In the Query menu choose Combine. Notice how GQL redraws your qualifications to reflect what you've done.
- Execute the query.
If you are the "doubting Thomas" type, you can redo the query without combining
the qualifications connected by the 'or' and you will get a different (and incorrect) result!
This page was last updated on March 31, 1997.
[Home |
Announcements |
Access |
Installation |
User Notes |
Data Dictionary |
Mailing List |
Contact]
|