When AND is used to connect two conditions, each conditional expression must be true for the condition to be true and the row retrieved. If any condition within a compound condition is false, the compound condition is false and the row is not selected.
For example, if you want to retrieve the records of Corporate Division
Departments with a budget under % latex2html id marker 5418
$10,000 you can write the following
DIV = 'CORP' AND BUDGET < 12000
In this example,
AND is the logical operator.
Table here illustrates the four possible cases that can occur with the logical operator AND for the compound condition just described.
|Values for||Values for||Condition1||Condition2|
| || || || ||Yields||Row Result|
|1|| || ||True||True||True||Retrieved|
|2|| || ||True||False||False||Not retrieved|
|3|| || ||False||True||False||Not retrieved|
|4|| || ||False||False||False||Not retrieved|
Example: Based on the above, let's develop a list of departments in the Corporate Division with a budget under $12,000.
If you enter the statement:
SELECT DNAME, DIV, BUDGET
WHERE DIV = 'CORP' AND BUDGET < 12000 ;
the result displayed will be:
DNAME DIV BUDGET Supplies and Procurement CORP 10500