Which query will provide the required output?

You need to list the employees in DEPARTMENT_ID 30 in a single row, ordered by HIRE_DATE.
Examine the sample output:

Which query will provide the required output?

You need to list the employees in DEPARTMENT_ID 30 in a single row, ordered by HIRE_DATE.
Examine the sample output:

Which query will provide the required output?

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions089.htm



Leave a Reply 3

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


Eduardo Lima

Eduardo Lima

group_id name
——– —-
1 David
1 John
1 Alan
1 David
2 Julie
2 Charles

select group_id,
listagg(name, ‘,’) within group (order by name) as names
from demotable
group by group_id;

Result:
========

group_id names
——– —–
1 ‘Alan, David, David, John’
2 ‘Charles, Julie’

Mr. T

Mr. T

Yes, B.

You can exclude the other answers with just one look:
A: SELECT LISTAGG (last_name) -> “; ” is missing!
C: WHERE department_id = 30 WITHIN GROUP ORDER BY hire_date -> wrong keywords!
D: “EMP_LIST” -> Should be “Emp_list” in sample output!