exam questions

Exam 1z0-082 All Questions

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

Exam 1z0-082 topic 1 question 32 discussion

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

Which two statements are true about the WHERE and HAVING clauses in a SELECT statement? (Choose two.)

  • A. Aggregating functions and columns used in HAVING clauses must be specified in the SELECT list of a query
  • B. WHERE and HAVING clauses can be used in the same statement only if applied to different table columns
  • C. The HAVING clause can be used with aggregating functions in subqueries
  • D. The WHERE clause can be used to exclude rows before dividing them into groups
  • E. The WHERE clause can be used to exclude rows after dividing them into groups
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

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
NiciMilo
Highly Voted 3 years, 6 months ago
C & D are correct
upvoted 27 times
Ekos
3 years, 1 month ago
i agree, CD is the correct answer
upvoted 2 times
...
...
nautil2
Most Recent 3 months, 2 weeks ago
Selected Answer: CD
32 A - FALSE; there can be different aggregation function after SELECT and in HAVING clause; e.g. SELECT deptno, MIN(msal) AS "Lowest salary" FROM employees GROUP BY deptno HAVING MAX(msal) > 4000; B - FALSE; same columns can be used in WHERE and HAVING clause; e.g. SELECT deptno, MIN(msal) AS "Lowest salary" FROM employees WHERE msal<1000 GROUP BY deptno HAVING MIN(msal) < 1400; C - TRUE; HAVING can be used in subqueries, e.g. SELECT empno, deptno, msal FROM employees WHERE msal < (SELECT MIN(msal) AS "Lowest salary" FROM employees GROUP BY deptno HAVING MIN(msal) > 1200); D - TRUE; first rows are filtered, then group functions are applied to remaining rows E - FALSE; see D
upvoted 2 times
...
zouve
5 months, 2 weeks ago
Selected Answer: CD
CD for me
upvoted 1 times
...
raferen10
1 year, 1 month ago
Selected Answer: CD
C and D are correct
upvoted 1 times
...
Franky_T
1 year, 8 months ago
Selected Answer: CD
A is wrong. The issue in this answer is the "and columns" portion. Having clauses may only contain a group function that was used in the select list. B is wrong. This answer is silly. The where clause "looks" at table (column) data and the having clause "looks" at group function results. Remember that the WHERE clause pre-filters table data and the HAVING clause post-filters group function results. C is correct. Having clauses can be used with aggregate functions in a subquery, as long as the result is properly used in the main query. D is correct. The WHERE clause pre-filters data from the table before the GROUP BY clause divides them into groups. E is wrong. The HAVING clause should be used as a post-filter in aggregate queries.
upvoted 1 times
...
Aramazd
1 year, 9 months ago
HR user can connect to the DB can also give create session to other users but he cannot do DML QL> create table students (ID number(10), name varchar(20) ) ; create table students (ID number(10), name varchar(20) ) * ERROR at line 1: ORA-01031: insufficient privileges SQL>
upvoted 1 times
...
ryuah
2 years ago
B,C,D is correct
upvoted 1 times
ryuah
1 year, 11 months ago
C,D is correct
upvoted 1 times
...
...
NowOrNever
3 years, 3 months ago
B is wrong https://www.techonthenet.com/oracle/having.php SELECT expression1, expression2, ... expression_n, aggregate_function (aggregate_expression) FROM tables [WHERE conditions] GROUP BY expression1, expression2, ... expression_n HAVING having_condition;
upvoted 2 times
...
you1234
3 years, 6 months ago
B & D is correct one
upvoted 1 times
...
you1234
3 years, 6 months ago
A & D is correct answer
upvoted 1 times
ama
3 years, 6 months ago
A is wrong … look at this example : select file#,avg(rfile#) from v$datafile Group by file# having Count(TS#) >0 file# avg(rfile#) ----------------------- 1 1 6 6 5 5 8 1024 3 3 7 10
upvoted 6 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