Q15. Evaluate the following two queries:
SQL> SELECT cust_last_name, cust_city
FROM customers
WHERE cust_credit_limit IN (1000, 2000, 3000);
SQL> SELECT cust_last_name, cust_city
FROM customers
WHERE cust_credit_limit = 1000 or cust_credit_limit = 2000 or cust_credit_limit = 3000
Which statement is true regarding the above two queries?
A. Performance would improve in query 2 only if there are null values in theCUST_CREDIT_LIMIT column.
B. There would be no change in performance.
C. Performance would degrade in query 2.
Explanation:
CASE Expression
Facilitates conditional inquiries by doing the work of an
IF-THEN-ELSE statement:
CASE expr WHEN comparison_expr1 THEN return_expr1
[WHEN comparison_expr2 THEN return_expr2
WHEN comparison_exprn THEN return_exprn
ELSE else_expr]
END
SQL> SELECT cust_last_name, cust_city
FROM customers
WHERE cust_credit_limit IN (1000, 2000, 3000);
SQL> SELECT cust_last_name, cust_city
FROM customers
WHERE cust_credit_limit = 1000 or cust_credit_limit = 2000 or cust_credit_limit = 3000
Which statement is true regarding the above two queries?
A. Performance would improve in query 2 only if there are null values in theCUST_CREDIT_LIMIT column.
B. There would be no change in performance.
C. Performance would degrade in query 2.
D. Performance would improve in query 2.
Correct Answer: B
Explanation/Reference:Explanation:
CASE Expression
Facilitates conditional inquiries by doing the work of an
IF-THEN-ELSE statement:
CASE expr WHEN comparison_expr1 THEN return_expr1
[WHEN comparison_expr2 THEN return_expr2
WHEN comparison_exprn THEN return_exprn
ELSE else_expr]
END