Which statement is true regarding the execution of the above queries?

View the Exhibit and examine the structure of the CUSTOMERS table. You want to
generate a report showing the last names and credit limits of all customers whose last
names start with A, B, or C, and credit limit is below 10, 000. Evaluate the following two
queries: Which statement is true regarding the execution of the above queries?

View the Exhibit and examine the structure of the CUSTOMERS table. You want to
generate a report showing the last names and credit limits of all customers whose last
names start with A, B, or C, and credit limit is below 10, 000. Evaluate the following two
queries: Which statement is true regarding the execution of the above queries?

A.
Only the second query gives the correct result.

B.
Both execute successfully and give the same result.

C.
Both execute successfully but do not give the required result.

D.
Only the first query gives the correct result.

Explanation:



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Norro

Norro

The correct Answer is B. Both execute successfully and give the same result.

See: http://www.w3schools.com/sql/sql_between.asp

BETWEEN Operator with Text Value Example
The following SQL statement selects all products with a ProductName beginning with any of the letter BETWEEN ‘C’ and ‘M’:

Example:
SELECT * FROM Products WHERE ProductName BETWEEN ‘C’ AND ‘M’;

Norro

Norro

Sorry the only correct answer is A. Only the second query gives the correct result.

SELECT LAST_NAME FROM EMPLOYEES WHERE UPPER(LAST_NAME) BETWEEN ‘A’ AND ‘C’ ORDER BY LAST_NAME;
Abel
Ande
Atkinson
Austin
Baer
Baida
Banda
Bates
Bell
Bernstein
Bissot
Bloom
Bull

SELECT LAST_NAME FROM EMPLOYEES WHERE UPPER(LAST_NAME) LIKE ‘A%’ OR UPPER(LAST_NAME) LIKE ‘B%’ OR UPPER(LAST_NAME) LIKE ‘C%’ ORDER BY LAST_NAME;

Abel
Ande
Atkinson
Austin
Baer
Baida
Banda
Bates
Bell
Bernstein
Bissot
Bloom
Bull
Cabrio
Cambrault
Cambrault
Chen
Chung
Colmenares

It seems that in Orcale databases, BETWEEN selects fields between the test values (A), including the first test value and EXCLUDING the last test value (C).

Johnny

Johnny

you mean D is correct, second query will not include names starting with C%