Which statement is true regarding the above queries?

Examine the structure of the TRANSACTIONS table:
Name Null Type
TRANS_ID NOT NULL NUMBER(3)
CUST_NAME VARCHAR2(30)
TRANS_DATE DATE
TRANS_AMT NUMBER(10,2)

You want to display the transaction date and specify whether it is a weekday or weekend.
Evaluate the following two queries:

Which statement is true regarding the above queries?

Examine the structure of the TRANSACTIONS table:
Name Null Type
TRANS_ID NOT NULL NUMBER(3)
CUST_NAME VARCHAR2(30)
TRANS_DATE DATE
TRANS_AMT NUMBER(10,2)

You want to display the transaction date and specify whether it is a weekday or weekend.
Evaluate the following two queries:

Which statement is true regarding the above queries?

A.
Both give wrong results.

B.
Both give the correct result.

C.
Only the first query gives the correct result.

D.
Only the second query gives the correct result.

Explanation:
Range Conditions Using the BETWEEN Operator
Use the BETWEEN operator to display rows based on a range of values:
SELECT last_name, salary
FROM employees
WHERE salary BETWEEN 2500 AND 3500;
Range Conditions Using the BETWEEN Operator
You can display rows based on a range of values using the BETWEEN operator. The range that
you specify contains a lower limit and an upper limit.
The SELECT statement in the slide returns rows from the EMPLOYEES table for any employee
whose salary is between $2,500 and $3,500.
Values that are specified with the BETWEEN operator are inclusive. However, you must specify
the lower limit first.
You can also use the BETWEEN operator on character values:
SELECT last_name

FROM employees
WHERE last_name BETWEEN ‘King’ AND ‘Smith’;



Leave a Reply 4

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


Nikhil

Nikhil

both query gives the results…
So B is correct

Gabriel K

Gabriel K

Both give results or both give correct results?

filavander

filavander

Both give results only C is correct answer.

Eamon

Eamon

@filavander, yeap your right.
@Gabriel K , you cool too.