exam questions

Exam 1z0-082 All Questions

View all questions & answers for the 1z0-082 exam

Exam 1z0-082 topic 1 question 56 discussion

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

Examine the description of the EMPLOYEES table:

Which query is valid?

  • A. SELECT dept_id, AVG(MAX(salary)) FROM employees GROUP BY dept_id;
  • B. SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id;
  • C. SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id, join_date;
  • D. SELECT dept_id, MAX(AVG(salary)) FROM employees GROUP BY dept_id;
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
you1234
Highly Voted 4 years ago
C is correct answer
upvoted 23 times
...
danito
Highly Voted 4 years, 1 month ago
I think C
upvoted 9 times
Ekos
3 years, 7 months ago
i agree
upvoted 2 times
...
...
8hyehye8
Most Recent 3 months, 2 weeks ago
Selected Answer: C
C is correct
upvoted 1 times
...
guimaleo
4 months, 3 weeks ago
Selected Answer: C
C is correct, and by the way is also the only valid query on the question. A) ORA-00937: not a single-group group function B)ORA-00979: not a GROUP BY expression D)ORA-00937: not a single-group group function
upvoted 1 times
...
nautil2
8 months, 2 weeks ago
Selected Answer: C
A - false; returns error ORA-00937: not a single-group group function; first occurence of dept_id is marked as the cause of the error B - false; returns error ORA-00979: not a GROUP BY expression; join_date is marked as the cause of the error C - true; columns mentioned between SELECT and FROM keywords are also mentioned after GROUP BY clause D - false; same as answer A
upvoted 2 times
...
auwia
1 year ago
Selected Answer: B
I see only B as invalid query, probably the question is wrong and it should be: Which query is INvalid?
upvoted 1 times
...
fthusa
1 year, 1 month ago
C is correct
upvoted 1 times
...
FelipeC
1 year, 4 months ago
Selected Answer: C
A (FALSE). SELECT dept_id, AVG(MAX(salary)) FROM employees GROUP BY dept_id; select DEPARTMENT_ID, AVG(MAX(SALARY)) from EMPLOYEES group by DEPARTMENT_ID; ERROR at line 1: ORA-00937: not a single-group group function B (FALSE). SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id; select DEPARTMENT_ID, HIRE_DATE,sum(salary) from EMPLOYEES group by DEPARTMENT_ID * ERROR at line 1: ORA-00979: not a GROUP BY expression C (TRUE). SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id, join_date; SQL> select DEPARTMENT_ID, HIRE_DATE,SUM(SALARY) from EMPLOYEES group by DEPARTMENT_ID , HIRE_DATE; DEPARTMENT_ID HIRE_DATE SUM(SALARY) ------------- --------- ----------- 60 25-JUN-05 4800 D (FALSE). SELECT dept_id, MAX(AVG(salary)) FROM employees GROUP BY dept_id; SELECT DEPARTMENT_ID , MAX(AVG(salary)) FROM employees GROUP BY DEPARTMENT_ID * ERROR at line 1: ORA-00937: not a single-group group function
upvoted 2 times
...
OCP19c
1 year, 10 months ago
C is correct answer B is wrong answer, because not working! But why not A not ?
upvoted 1 times
mamadu
1 year ago
A and D are wrong simply because we cannot use nested group functions while grouping by any specific column, we should use the whole table as one group (by not using a group by clause) otherwise the query would not make sense.
upvoted 1 times
...
...
algerianphoenix
2 years, 2 months ago
C, by testing on OE DB sample.
upvoted 1 times
...
Franky_T
2 years, 2 months ago
Selected Answer: C
A is wrong. When using nested aggregate functions you are not allowed to display any additional column(s) other than the nested aggregate function. B is wrong. Missing the join_date column in the GROUP BY clause. The rule states: "Any column in the select list that's not part of an aggregate function MUST BE in the group by clause". C is correct. D is wrong. Same issue as with option A.
upvoted 2 times
...
Sankar1406
2 years, 3 months ago
Selected Answer: C
C for sure
upvoted 1 times
...
sagartake
2 years, 3 months ago
Selected Answer: B
B is correct
upvoted 1 times
algerianphoenix
2 years, 2 months ago
C, in B there is a missing column in the group by clause.
upvoted 2 times
...
...
ryuah
2 years, 6 months ago
C is correct
upvoted 1 times
...
Taush
2 years, 10 months ago
I created the same table with same data type: Option A and B gave errors while C and D gave the same output.
upvoted 1 times
...
Guhborges
2 years, 10 months ago
C is the correct answer: SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id, join_date; All options with non-groupable functions need to be added in GROUP BY.
upvoted 1 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago