|
We will analyze previous written
SQL equations:
1)
3 different Where filter equations had been written for the same field (order_date).
2)
With * we marked it to present all the fields.
If we should show only two fields, after that we must mention them in select
command.
All of it was taking away the time at writing select equation.
3)
Each of these 3 select equations could have its different titles showing
in some report.
4)
Our user must know SQL orders.
5)
Our user must know a structure of a table for which he wants to write
filter equation.
6)
Our user must apply meditative activity, to form filter demand.
One field from table makes so much difficulties. What will be happened with 2,3,
fields, or what kind of thinking
problem one user could make to form filter equation. Sometimes, that equation
could be so complicated, and also, so real in life.
The users are very required and they expect to solve problems quickly.
Negating conditions with The
NOT operator
Regarding to all the conditions tested by logical operators we discussed
here, there is a way to negate each of these operators
to change the condition’s point of view.
The not operator reverses the meaning of logical operator with which has been
used.
SELECT
* ;
FROM order ;
WHERE NOT order_date >= 23/05/1995
SELECT
* ;
FROM order ;
WHERE NOT BETWEEN(order_date ,23/05/1995 , 28/06/1995)
SELECT * ;
FROM order ;
WHERE NOT order_date <= 15/06/1995
Filter with Null value
Also, there are one more problems.We can filtrate our field order_date to
null value.
The null operator is used to compare a value with a null value.
SELECT
* ;
FROM order ;
WHERE order_date IS NULL
The IS NULL operator is negated
as IS NOT NULL to test for values that are not NULL.
SELECT
* ;
FROM order ;
WHERE order_date IS NOT NULL
|