Compound conditions can include both AND and OR logical operators.
Example:
If you enter the query:
SELECT DNAME, DIV, BUDGET
FROM DEPARTMENT
WHERE DIV = 'CORP' AND BUDGET < 12000 OR DIV = 'PROD' ;
the result displayed will be:
DNAME DIV BUDGET Supplies and Procurement CORP 10500 Research and Development PROD 27500 Manufacturing PROD 32000 Customer Support and Service PROD 11000 Product Marketing and Sales PROD 25000 |
When you have a combination of AND and OR operators, the AND operators are evaluated first; then the OR operators are evaluated. Therefore, in the above query, rows from the DEPARTMENT table are retrieved if they satisfy at least one of the folloiwng conditions: