Home » SQL & PL/SQL » SQL & PL/SQL » partition
partition [message #287434] Wed, 12 December 2007 04:21 Go to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
Hi

Some one please expalin me how this query working ?

SELECT manager_id, last_name, hire_date, salary,
AVG(salary) OVER (PARTITION BY manager_id ORDER BY hire_date
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS c_mavg
FROM employees;

Thanks in advance,
Sathish
Re: partition [message #287437 is a reply to message #287434] Wed, 12 December 2007 04:25 Go to previous messageGo to next message
Michel Cadot
Messages: 64124
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In short, it gives the average of your salary and the previous and next hired ones for your manager.

Database SQL Reference
Chapter 5 Functions
Section SQL Functions
Subsection Analytic Functions

Regards
Michel

[Updated on: Wed, 12 December 2007 04:25]

Report message to a moderator

Re: partition [message #287442 is a reply to message #287434] Wed, 12 December 2007 04:32 Go to previous message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
Thanks
Previous Topic: Query Problem (Not returning required result)
Next Topic: error in utl_file
Goto Forum:
  


Current Time: Wed Dec 07 06:41:17 CST 2016

Total time taken to generate the page: 0.08549 seconds