Results 1 to 3 of 3

Thread: Give example of mixmize and minimum salary find.

  1. #1
    bhushanbhangale
    Guest

    Exclamation Give example of mixmize and minimum salary find.

    Hello friends,
    Can any one give me the sql query which find the min and max salary find in the table. also tell me that how to find any 2nd and 3rd greatest salary in the given table.


  2. #2
    Contributing Member
    Join Date
    Sep 2007
    Answers
    44

    Re: Give example of mixmize and minimum salary find.

    Replace "n" with the no. u want to get the nth highest salary.
    select *
    from emp e1
    where ( n =
    ( select count ( distinct ( e2.sal ) )
    from emp e2
    where e2.sal >=e1.sal))


  3. #3
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Give example of mixmize and minimum salary find.

    You may get the result using the following query also

    select level, max('col_name') from my_table
    where level = '&n'
    connect by prior ('col_name') > 'col_name')
    group by level;


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact