|
The linearity of filter
Introduction LOF
Filter linearity denotes the relationship between objects, operators
and brackets. The position of brackets has direct impact on the result of our
WHERE expression. We have already used expressions with brackets in the previous
cases, for example:
SELECT ;
order. number_invoice ;
order. order_date ;
order.value_invoice ;
order. payment ;
customer. company_ name ;
FROM order, customer ;
WHERE ;
order.order_id IN (“ 200”,” 300”,”
660”,” 1020” )
The feature of IN operator is to
have brackets, in the same way as the extended objects. However, on the global
level, the reflexive problem
which is to be solved, can be very complicated and may imply the existence
of brackets. Some reflections on linearity will facilitate
the resolvement of some very difficult problem.
We shall take into consideration the following cases of filter linearity:
1)
Linear filter
2)
Quasi linear filter
3)
NonLinear filter
Linear filter
We here consider the filtering expression without brackets with the AND/OR
operator. We do not here include either the IN or extended object.
For example:
SELECT * ;
FROM order ;
WHERE ;
BETWEEN(order_date ,23/05/1995 , 28/06/1995) .AND. ;
BETWEEN(order.value_invoice
, 2000,4000)
or
SELECT * ;
FROM order ;
WHERE ;
BETWEEN(order_date ,23/05/1995 , 28/06/1995) .OR. ;
BETWEEN(order.value_invoice
, 2000,4000)
That
thing which is of our frequent interest, is when the filtering expression gets
combined with the AND operator and that type of filter will be called the
eliminating filter.
Quasi linear filter
If you use IN operator in the filtering expression, as well as the extended
objects and advanced extended objects combined with OR/AND operator, you will
get a quasi linear filter.
SELECT ;
order. number_invoice ;
order. order_date ;
order.value_invoice ;
order. payment ;
customer. company_ name ;
FROM order, customer ;
WHERE ;
order.order_id IN (“ 200”,” 300”,”
660”,” 1020” ) .AND. ;
order_date >= 23/05/1995 .AND. ;
( BETWEEN(order.value_invoice
,200,220) .OR.;
BETWEEN(order.value_invoice
,300,330) .OR. ;
BETWEEN( order.value_invoice
,
660,662) .OR. ;
BETWEEN(order.value_invoice
,1020,1270) .OR. ;
order.value_invoice => 1900) )
In
essence, IN operator, extended object and advanced objects have brackets.
|