Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-071 Topic 9 Question 112 Discussion

Actual exam question for Oracle's 1Z0-071 exam
Question #: 112
Topic #: 9
[All 1Z0-071 Questions]

Examine the description of the ORDER_ITEMS table:

Examine this incomplete query:

SELECT DISTINCT quantity * unit_price total_paid FROM order_items ORDER BY ;

Which two can replace so the query completes successfully?

Show Suggested Answer Hide Answer
Suggested Answer: B, C

In Oracle SQL, when you subtract a number from a date, the result is a date. When you subtract one date from another, the result is the number of days between the two dates.

B: PROMO_BEGIN_DATE - 5 will subtract 5 days from the PROMO_BEGIN_DATE, resulting in a new date that is 5 days earlier than PROMO_BEGIN_DATE.

C: PROMO_BEGIN_DATE - SYSDATE will return the number of days between the PROMO_BEGIN_DATE and the current date (SYSDATE).

The incorrect options are:

A: TONUMBER(PROMO_BEGIN_DATE) - 5 will not return a number because PROMO_BEGIN_DATE is a date, and TONUMBER is not a valid function to convert dates to numbers in Oracle.

D: PROMO_BEGIN_DATE - SYSDATE will not return an error; it will return the number of days between the two dates as explained above.

E: TODATE(PROMO_BEGIN_DATE * 5) will not return a date because PROMO_BEGIN_DATE * 5 is not a valid operation in Oracle SQL as you cannot multiply a date by a number, and TODATE is not a valid function. The correct function name is TO_DATE.


Oracle Documentation on Date Arithmetic: Database SQL Language Reference - Datetime Functions

Contribute your Thoughts:

Theron
1 months ago
I'm just wondering if the 'ORDER_ITEMS' table is where they keep all the order items that are out of order.
upvoted 0 times
Roselle
8 days ago
B) quantity, unit_price
upvoted 0 times
...
Kristin
10 days ago
A) quantity
upvoted 0 times
...
...
Tammara
1 months ago
A) quantity? Really? That's like ordering a meal by the number of forks you used. E) is the only logical choice here.
upvoted 0 times
...
Dorothea
2 months ago
Hmm, I was leaning towards C) total_paid, but I guess that would be circular reasoning. E) is the way to go!
upvoted 0 times
Norah
4 days ago
Hmm, I was leaning towards C) total_paid, but I guess that would be circular reasoning. E) is the way to go!
upvoted 0 times
...
Matthew
17 days ago
I agree, E) quantity * unit_price makes the most sense.
upvoted 0 times
...
Kiley
1 months ago
I think E) quantity * unit_price is the correct choice.
upvoted 0 times
...
...
Dustin
2 months ago
B) quantity, unit_price looks good to me. Ordering by the individual columns that make up the total_paid calculation should also work.
upvoted 0 times
Martina
7 days ago
Let's go with B) quantity, unit_price then.
upvoted 0 times
...
Clarinda
10 days ago
Agreed, ordering by the individual columns that make up the total_paid calculation should work.
upvoted 0 times
...
Michell
21 days ago
I think B) quantity, unit_price is the correct choice.
upvoted 0 times
...
...
Major
2 months ago
I think the correct answer is E) quantity * unit_price. It makes sense to order the results by the computed total_paid column.
upvoted 0 times
Arlyne
1 months ago
Yes, that would give us the total amount paid for each order item.
upvoted 0 times
...
Teddy
2 months ago
I agree, ordering by the computed total_paid column would make sense.
upvoted 0 times
...
Emiko
2 months ago
I think the correct answer is E) quantity * unit_price.
upvoted 0 times
...
...
Gene
3 months ago
But the query is looking for a column to order by, so it should be B) quantity, unit_price.
upvoted 0 times
...
Sarah
3 months ago
I disagree, I believe the answer is E) quantity * unit_price.
upvoted 0 times
...
Gene
3 months ago
I think the answer is B) quantity, unit_price.
upvoted 0 times
...

Save Cancel