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
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.
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>
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;
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
...
...
Log in to ExamTopics
Sign in:
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.
NiciMilo
Highly Voted 3 years, 6 months agoEkos
3 years, 1 month agonautil2
Most Recent 3 months, 2 weeks agozouve
5 months, 2 weeks agoraferen10
1 year, 1 month agoFranky_T
1 year, 8 months agoAramazd
1 year, 9 months agoryuah
2 years agoryuah
1 year, 11 months agoNowOrNever
3 years, 3 months agoyou1234
3 years, 6 months agoyou1234
3 years, 6 months agoama
3 years, 6 months ago