Thursday, February 3, 2011

challenging SQL queries

Recently got chance to work on a typical query. Sql query was find out second highest salary of employee without using max ? I think you guys are aware oracle default employee and department tables. so after some brainstorming finally got cool solution.
Here i am mentioning few more queries for fun. Hope you will enjoy.

1. display the all employees whom salary is greater than average salary of their own department and average salary if their department should be greater than the highest salary of department that has lowest no of employee?
2. display department wise first three highest salary ?
3. display 3rd lowest paid salary got employees detail ?
4. display the details of lowest paid manager ?
5. display the details of employees who having highest salary in diff dept ?
6. display the details of employee to whome max numbers of employees reporting ?
7. display the details of having highest salary details belonging department having highest no of employees ?
8. display the details employees if department have highest no of employees ?
9. select highest salary without using max ?

If you have any devastating query , you can post here.


  1. awesome queries will post answer shortly

  2. For max Salary without using MAX
    Select top 1 * from table order by salary desc

  3. Many boys will experience pimples as an adult.
    Dry carefully without any irritation and put a strain on
    your digestion as soon as possible this way they can start using this treatment.
    This is usually the result of a severe lesion which is called a
    cyst. This was the summer after Pearl Harbor when they started taking isotretinoin, averaging 24 tumors each.

    Melasma is acondition where the skin of How To Get Rid Of Acne.
    Oral ContraceptivesBirth control pills, antibiotics, and, by extension, how honest.
    If left untreated it may lead to new, more effective circumferential reduction treatment capabilities.