Which statement would achieve this purpose?

View the Exhibit and examine the description of the ORDERS table. The orders in the ORDERS table are placed through sales representatives only. You are given the task to get the SALES_REP_ID from the ORDERS table of those sales representatives who have successfully referred more than 10 customers. Which statement would achieve this purpose?

View the Exhibit and examine the description of the ORDERS table.

The orders in the ORDERS table are placed through sales representatives only. You are given the task to get the SALES_REP_ID from the ORDERS table of those sales representatives who have successfully referred more than 10 customers.

Which statement would achieve this purpose?

A.
SELECT sales_rep_id, COUNT(customer_id) “Total”
FROM orders
HAVING COUNT(customer_id) > 10;

B.
SELECT sales_rep_id, COUNT(customer_id) “Total”
FROM orders
WHERE COUNT(customer_id) > 10
GROUP BY sales_rep_id;

C.
SELECT sales_rep_id, COUNT(customer_id) “Total”
FROM orders
GROUP BY sales_rep_id
HAVING total > 10;

D.
SELECT sales_rep_id, COUNT(customer_id) “Total”
FROM orders
GROUP BY sales_rep_id
HAVING COUNT(customer_id) > 10;



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Anurag

Anurag

the option d is correct because
some rules follow

alias is not use in group by
aggregate function not use with where clause
having use with group by clause
aggregate function with having to exclude group

user

user

select 1 + ” from dual;

create table aio166 (a number, b number);
insert into aio166 values (5, ”);

select a+b from aio166;

select i.empno from emp i left outer join emp u on (i.empno=u.empno)
where (i.sal > 100);

SELECT job, COUNT(sal) t
FROM emp
GROUP BY job
HAVING t > 10;

SELECT job, COUNT(sal) t
FROM emp
GROUP BY job
HAVING COUNT(sal) > 10;

SELECT job j, COUNT(sal) t
FROM emp
GROUP BY j
HAVING COUNT(sal) > 10;