Home » SQL & PL/SQL » SQL & PL/SQL » Exlain Plan for Group By Clause
Exlain Plan for Group By Clause [message #223481] Fri, 09 March 2007 02:24 Go to next message
techie2007
Messages: 1
Registered: March 2007
Junior Member
Hi everyone
i have a doubt regarding group by clause ,although might sound very common still wanted to know the intricacies involved.Tried seraching on forum but could not get much abt it.
Just wanted to know if group by clause works on the sample data set or not,I mean if suppose i have a query

select dept_id,
department_name,
sum(students)
from departments
group by dept_id,
department_name
order by dept_id;

here grouping is done before the rows are fetched(i.e. just after the select stament & no filter condition) or after the rows are fetched (i.e. after where clause)

Thanks,
Techie
Re: Exlain Plan for Group By Clause [message #223500 is a reply to message #223481] Fri, 09 March 2007 03:29 Go to previous message
Muddassar
Messages: 28
Registered: March 2007
Junior Member
Any query in Oracle follows the following rule:

1. Choose rows based on the WHERE clause.
2. Group the rows together based on the GROUP BY clause
3. Calculate the results of the group functions for each group.
4. Choose and eliminate groups based on the HAVING clause.
5. Order the groups based on the results of the group functions in the ORDER BY clause.

So, you can apply this to any of your query and get your answer. Hope this helps.
Previous Topic: How to Select Data From Two different Databases?
Next Topic: How to send a email through procedure
Goto Forum:
  


Current Time: Sat Dec 10 05:23:49 CST 2016

Total time taken to generate the page: 0.15768 seconds