Skip to main content
The ORDERS table has these columns:


ORDER_ID NUMBER(4) NOT NULL
CUSTOMER_ID NUMBER(12) NOT NULL
ORDER_TOTAL NUMBER(10,2)


The ORDERS table tracks the Order number, the order total, and the customer to whom the Order belongs. Which two statements retrieve orders with an inclusive total that ranges between
100.00 and 2000.00 dollars?

A.SELECT customer_id, order_id, order_total
FROM orders
RANGE ON order_total (100 AND 2000) INCLUSIVE;

B.SELECT customer_id, order_id, order_total
FROM orders
HAVING order_total BETWEEN 100 and 2000;

C. SELECT customer_id, order_id, order_total
FROM orders
WHERE order_total BETWEEN 100 and 2000;

D. SELECT customer_id, order_id, order_total
FROM orders
WHERE order_total >= 100 and <= 2000;

Answer:C
Explanation:
Answers C provides correct results to show. You can use BETWEEN or comparison
operations to retrieve data.

Incorrect Answers
A: There is no RANGE ON or INCLUSIVE keyword in Oracle.
B: HAVING clause can be use only in conjunction with the GROUP BY clause.
D: Syntax 'order_total >= 100 and <= 2000' is incorrect.

Comments

Popular posts from this blog

Question 8: Aggregate Functions

Examine the description of the STUDENTS table: STD_ID NUMBER(4) COURSE_ID VARCHARD2(10) START_DATE DATE END_DATE DATE Which two aggregate functions are valid on the START_DATE column? (Choose two) A. SUM(start_date) B. AVG(start_date) C. COUNT(start_date) D. AVG(start_date, end_date) E. MIN(start_date) F. MAXIMUM(start_date) Answer: C & E Explanation: It is possible to apply COUNT() and MIN() functions on the column with DATE data type. Incorrect Answers A: Function SUM() cannot be used with DATE data type column. B: Function AVG() cannot be used with DATE data type column. D: Function AVG() cannot be used with DATE data type column, and function AVG() just has one parameter X, not two. It averages all X column values returned by the SELECT statement. F: There is no MAXIMUM() function in Oracle, only MAX() function exists.

20. TRIM Function

Which SELECT statement will the result 'elloworld' from the string 'HelloWorld'? A. SELECT SUBSTR( 'HelloWorld',1) FROM dual; B. SELECT INITCAP(TRIM ('HelloWorld', 1,1)) FROM dual; C. SELECT LOWER(SUBSTR('HellowWorld', 1, 1) FROM dual; D. SELECT LOWER(SUBSTR('HelloWorld', 2, 1) FROM dual; E. SELECT LOWER(TRIM ('H' FROM 'HelloWorld')) FROM dual; Answer: E Explanation: TRIM function accept a string describing the data you would like to trim from a column value. It can trim from both side of column value i.e. left and right. In the following statement this functionwill trim as SELECT LOWER(TRIM ('+' FROM 'HelloWorld')) FROM dual; From the above statement trim function will remove the character 'H' from 'HelloWorld' and LOWER function will convert the remaining character to lower case.