Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-082 topic 1 question 50 discussion

Actual exam question from Oracle's 1z0-082
Question #: 50
Topic #: 1
[All 1z0-082 Questions]

View the Exhibits and examine the structure of the COSTS and PROMOTIONS tables.
You want to display PROD_IDS whose promotion cost is less than the highest cost PROD_ID in a promotion time interval.
Examine this SQL statement:

Exhibit 1.

Exhibit 2.

What will be the result?

  • A. It gives an error because the ALL keyword is not valid
  • B. It gives an error because the GROUP BY clause is not valid
  • C. It executes successfully but does not give the required result
  • D. It executes successfully and gives the required result
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ioio
Highly Voted 3 years ago
the correct answer is C but so far nobody explained the correct reason! the issue here is not the ALL operator but the last line of the query: (promo_end_date - promo_begin_date) is returning the number of days which the promotion was running, but no interval, which is requested by the question. so logically the query is not generating desired output.
upvoted 7 times
yukclam9
3 years ago
dear ioio, you are right with the returned data type. however I see the promotion time interval as time difference between promotion, so it is more of a logical concept rather than requirement on data type.
upvoted 2 times
...
...
NowOrNever
Highly Voted 3 years, 7 months ago
C- correct answer display PROD_IDS whose promotion cost is less than the highest cost PROD_ID WHERE promo_cost < ALL (SELECT MAX(promo_cost) FROM promotions GROUP BY (promo_end_date - promo_begin_date))); “< ALL …” here is the mistake, if the next selection returns not only one max value, it returns the wrong, maybe even an empty result
upvoted 6 times
...
kaz40
Most Recent 5 months, 2 weeks ago
C must be correct. D would be correct with WHERE promo_cost < ANY
upvoted 2 times
...
nautil2
6 months, 1 week ago
Selected Answer: D
A - false; keyword ALL is valid, it is used in Group Comparison Conditions, see Oracle doc: Oracle Database, Release 19, SQL Language Reference, 6 Conditions, Comparison Conditions B - false; GROUP BY clause is valid, it is used with Aggregate Functions, see Oracle doc: Oracle Database, Release 19, SQL Language Reference, 7 Functions, Aggregate Functions: C - false; The query gives required results. The most inner query returns maximum promotional costs within groups formed with all promotions with same duration in days. The inner query which starts SELECT promo_id returns those ID of promotions, which costs is smaller than any maximum costs returned with the most inner query. The outer query returns those product IDs, which have the promo_id returned with the previous query. There must be some promo_cost which is smaller than any maximum promo_cost within groups. Only in that case the query returns some rows. D - true; see C
upvoted 1 times
...
Lydia1054
9 months ago
I think both C and D can be right, and it depends on the data: 1. Get the result: Two promotion data that have the same period but with different cost, and one cost has the minimum cost of all promotions. >> if set the data like this: 1-$5000-period 10 days/ 2- $3000-period 15 days/ 3- $2500- period 30 days/ 4-$3500-period 30 days >> We can get the ALL list of ($5000, $3000, $3500), and $2500 will be left to the group but this cost is meet the < ALL situation and the related product ID will show up in the end. 2. No result in the end: If the example above change the third data to $3000, then we can still get the same ALL list ($5000, $3000, $3500) but there are no other cost that is less than the cost in the list. Therefore, we get no results.
upvoted 1 times
...
Darkseid1231
10 months ago
D D D IS CORRECT
upvoted 1 times
...
fthusa
11 months ago
CORRECT C , executing success but not giving expected answer
upvoted 1 times
...
J4vi
12 months ago
Selected Answer: D
I see no errors here
upvoted 1 times
...
hadiwuu
1 year, 3 months ago
who give the suggested anwer? why are all of it are wrong?
upvoted 1 times
...
Zairlam
2 years, 1 month ago
I have recreated the tables and inserted some random data on them and tested the query. The correct answer is C: When you run select prod_id from costs where prod_id in (select prod_id from promotions where promo_cost < all (select max(promo_cost) from promotions group by (promo_end-promo_begin))); The query does go through but returns no results. When you run the same query without the group by part you get the expected results (prod_id 2 had the highest promo_cost) PROD_ID 1 3 4
upvoted 2 times
...
ryuah
2 years, 3 months ago
C is correct
upvoted 1 times
ryuah
2 years, 3 months ago
sry D is correct
upvoted 1 times
...
...
EIYA
2 years, 3 months ago
D is correct
upvoted 2 times
...
ogdru
3 years, 1 month ago
<ALL: less than the lowest value returned by subquery. <ANY: less than the highest value returned by subquery.
upvoted 5 times
Fan
3 years, 1 month ago
thank you.
upvoted 1 times
...
Shakhzod1999
1 year, 2 months ago
<ALL: less than the highest value returned by subquery. <ANY: less than the lowest value returned by subquery.
upvoted 1 times
...
...
Phat
3 years, 3 months ago
so what is the correct answer ???
upvoted 2 times
...
sseet40
3 years, 3 months ago
The correct answer is D. <ALL means that The value must be smaller than the smallest value in the list to evaluate to TRUE
upvoted 4 times
...
mberrios
3 years, 6 months ago
c - correct
upvoted 2 times
...
adoptc94
3 years, 7 months ago
I'd suggest answer A, but I am not completely sure!
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...