Home » SQL & PL/SQL » SQL & PL/SQL » Group By clause and sum(sal) (2 threads merged by bb)
Group By clause and sum(sal) (2 threads merged by bb) [message #394736] Mon, 30 March 2009 00:19 Go to next message
ramesh55.sse
Messages: 262
Registered: December 2008
Location: Hyderabad
Senior Member
Please give me a SQL query to retrieve employee number, employee name,department number and maximum salary for each department.It's very urgent.
Re: Group By clause [message #394737 is a reply to message #394736] Mon, 30 March 2009 00:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
{pointless and insulting comment removed}

[Updated on: Mon, 30 March 2009 05:44] by Moderator

Report message to a moderator

Re: Group By clause [message #394742 is a reply to message #394736] Mon, 30 March 2009 00:44 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
select empno, ename, deptno,
max(sal) over(partition by deptno order by deptno) sal
from emp;


regards,
Delna
Re: Group By clause [message #395031 is a reply to message #394742] Tue, 31 March 2009 02:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Don't put solution only hint or clue as requested in OraFAQ Forum Guide, "Responding to Posts" section:
Quote:
When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usual to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, and not provide complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.

Now OP didn't learn nothing when if you posted the link to MAX and analytic functions, it learns how to do it by himself.

Regards
Michel

[Updated on: Tue, 31 March 2009 02:29]

Report message to a moderator

sum(sal) [message #395264 is a reply to message #394736] Tue, 31 March 2009 23:53 Go to previous messageGo to next message
ramesh55.sse
Messages: 262
Registered: December 2008
Location: Hyderabad
Senior Member
Please give me a SQL query to retrieve employee number, employee name,department number and Sum of salary for each department.Using GROUP BY and analytical functions.

Re: sum(sal) [message #395265 is a reply to message #395264] Tue, 31 March 2009 23:58 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.

Post DDL for tables.
Post DML for test data.

Post expected/desired results.
Re: sum(sal) [message #395299 is a reply to message #395264] Wed, 01 April 2009 01:56 Go to previous message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
We don't do homework for you and you know it.
Use SQL*Plus and copy and paste what you already tried.

Regards
Michel
Previous Topic: ORA-30926: unable to get a stable set of rows in the source tables
Next Topic: Size of a clob [Split message]
Goto Forum:
  


Current Time: Sat Dec 07 06:40:18 CST 2024