|
By combining operators, it is possible to link multiple conditions.
The Boolean operators are not
commutative. That means, in complicated expressions the result depends on the mathematically
defined order of the subparts of the expression. Using brackets, the order can be completely
changed (Bill 1999).
Circle 1: Tree species = "Larch"
Circle 2: Stock > 110 m3/ha
Circle 3: Density > 80%
Venn-diagram | Condition | Corresponding SQL query |
---|---|---|
(3 AND 2) OR 1 | Select * from Parcel where (Density > 80% and Stock > 110 m3/ha) or Tree species = "Larch" |
|
1 AND (3 OR 2) | Select * from Parcel where Tree species = "Larch" and (Density > 80% or Stock > 110 m3/ha) |
|
(3 XOR 1) AND 2 | Select * from Parcel where (Density > 80% xor Tree species = "Larch" ) and Stock > 110 3/ha |
|
(2 OR 1) NOT 3 | Select * from Parcel where (Stock > 110 m3/ha or Tree species = "Larch") not Density > 80% |
|
3 OR (2 XOR 1) | Select * from Parcel where Density > 80% or (Stock > 110 m3/ha xor Tree species = "Larch") |
Try to solve the following exercises. Consider, in
particular, which operator is used:
Select all the roads of the type "Nebenstrasse", where the speed is limited to 50km/h (select the
objects by clicking on the rows of the table).
Select all the roads (all road types), where the speed is limited to 50km/h (select the objects by clicking on the rows of the table).
Select all the roads, where the speed is limited to 50km/h and which are not "Nebenstrassen" that have no limited velocity of 50km/h. Select also all the roads which are "Nebenstrasse" and which have no speed limit of 50km/h (select the objects by clicking on the rows of the table).
Select all the roads, where the speed is limited to 50km/h, but which are not "Nebenstrassen" (select the objects by clicking on the rows of the table).