View the Exhibit and examine the data in the products table.
You need to display product names from the products table that belong to the
‘software/other’ category with minimum prices as either S2000 or S4000 and no unit of
measure. You issue the following query:
Which statement is true regarding the above query?
A.
It executes successfully but returns no result.
B.
It executes successfully and returns the required result.
C.
It generates an error because the condition specified for PROD_UNIT_OF_MEASURE is
not valid.
D.
It generates an error because the condition specified for the prod category column is not
valid.
A
Why? I think that B is right answer.
Oracle treats empty strings as null values, so prod_unit_of_measure ” causes the query returns no result.
A
SQL> SELECT prod_name,prod_category,prod_min_price from products_q67
2 WHERE prod_category LIKE ‘%Other%’
3 AND (prod_min_price = 2000 OR prod_min_price = 4000)
4 AND prod_unit_of_measure ”;
no rows selected
SQL>
SQL>
SQL> SELECT prod_name,prod_category,prod_min_price from products_q67
2 WHERE prod_category LIKE ‘%Other%’
3 AND (prod_min_price = 2000 OR prod_min_price = 4000)
4 AND prod_unit_of_measure IS NOT NULL;
PROD_NAME PROD_CATEGORY PROD_MIN_PRICE
—————————— —————————— ————–
DVD-R SW/Other 2000
SQL>