This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes SQL Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "SQL Query" Watch "SQL Query" New topic
Author

SQL Query

Diwakar
Greenhorn

Joined: May 23, 2005
Posts: 9
Hi,
Can anyone provide me with an sql query using which I could find out the first employee details who has the second highest salary in Emp table.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Diwakar,
Yes, I can supply you with the SQL query you require (assuming it is for an Oracle database), but it seems that this is a homework assignment. If so, then perhaps you would care to explain to me why I (or someone else) should do your homework for you.

Good Luck,
Avi.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

Diwakar,
If you haven't seen Mark's note yet, please update your last name do more than an initial.

Regardless of whether this is a homework assignment, the key is to start building the query in little pieces.

Do you know how to write a SQL query to find out the highest salary? The second highest salary? The employee with a specific salary? Post some of these and then we can work with you to merge them into the query you need. Or you may find that the query writes itself at that point. Or if you get stuck on one of these, we can point you in the right direction.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Query
 
Similar Threads
How to Find Out There Are Identical Records Without Using the Select?
JDBC doesn't retrieve all the results available in the MSSQL database
Please help me to convert this SQL to hibernate query
Sub query(oracle) conversion to HQL/criteria
Hibernate 3 not able to recognize the "ON" word in sql