Figure 3-16 illustrates three queries. Query 1 returns four rows.
Query 2 is based on the first condition just discussed and returns four
rows. Query 3 is based on the second condition and returns zero
rows.
Changing the order of the conditions in the WHERE clause changes its
meaning due to the different precedence of the operators. Consider the
following code sample:
There are two composite conditions in this query. The first condition
retrieves the records with the character “a” in the LAST_NAME field ANDa
SALARY value greater than 100 times the DEPARTMENT_ID value AND where
the COMMISSION_PCT value is not null. The second condition fetches those
rows with JOB_ID values of MK_MAN. A row is returned by this query if it
conforms to either condition one ORcondition two but not necessarily to
both.
As Figure 3-17 illustrates, this query returns six rows. It further
shows the division of the query into two queries based on its two
composite conditions. The first condition results in five rows being
returned while the second results in the retrieval of just one row with
a JOB_ID value of MK_MAN.