Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Query

 
RaviSingh Kumar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just want an SQL query for the below mentioned condition.

There are several department having some number of employees.
Want the department id and respective salary for the department having maximum of average salary group by department.

Thanks in advance
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know myself. And I shan't know. We don't simply give out answers to that sort of question. Read this. Please post what you think and I am sure somebody will help.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are stuck, try starting with a smaller query. Can you figure out how to write a query to get the highest salary of an individual employee? How about the average salary for a single department? All the departments? etc

When you get stuck, post the last query you were able to write (that solves a smaller problem) and let us know what you got stuck on. This will let people give you more concrete help and will help you learn how to write queries. Handing out an answer doesn't do that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic