59. 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 $2000 or $4000 and no unit of measure.
You issue the following query:
SQL>SELECT prod_name, prod_category, prod_min_price
FROM products
WHERE prod_category LIKE '%Other%' AND (prod_min_price = 2000 OR
prod_min_price = 4000) AND prod_unit_of_measure <> '';
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.
当前,在oracle中,没有空字符串,''就是null。 在这儿 <> '',就是<> null。
判断是否为空,应使用is not null与is null。而与空值比较 <> null这种,结果也为空,所以不返回值。
Answer: A
You need to display product names from the PRODUCTS table that belong to the 'Software/Other '
category with minimum prices as either $2000 or $4000 and no unit of measure.
You issue the following query:
SQL>SELECT prod_name, prod_category, prod_min_price
FROM products
WHERE prod_category LIKE '%Other%' AND (prod_min_price = 2000 OR
prod_min_price = 4000) AND prod_unit_of_measure <> '';
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.
当前,在oracle中,没有空字符串,''就是null。 在这儿 <> '',就是<> null。
判断是否为空,应使用is not null与is null。而与空值比较 <> null这种,结果也为空,所以不返回值。
TEST >SELECT prod_name, prod_category, prod_min_price
2 FROM sh.products
3 WHERE prod_category LIKE '%Other%'
4 AND (prod_min_price = 199.99 OR prod_min_price = 44.99)
5 AND prod_unit_of_measure IS NOT NULL
6 AND rownum <= 1;
PROD_NAME PROD_CATEGORY PROD_MIN_PRICE
-------------------------------------------------- -------------------------------------------------- --------------
Unix/Windows 1-user pack Software/Other 199.99
已选择 1 行。
已用时间: 00: 00: 00.00
TEST >SELECT prod_name, prod_category, prod_min_price
2 FROM sh.products
3 WHERE prod_category LIKE '%Other%'
4 AND (prod_min_price = 199.99 OR prod_min_price = 44.99)
5 AND prod_unit_of_measure <> '';
未选定行
已用时间: 00: 00: 00.00
TEST >
Answer: A