3rd&5th highest salary from a table

3rd&5th highest salary from a table

how we get 3rd highest and 5th highest salary from a table

View Answers

March 11, 2011 at 1:59 PM

To find the third largest salary, use the following query:

select SALARY from emp e1 where (3-1) = (select count(distinct
(e2.SALARY)) from emp e2 where e2.SALARY>e1.SALARY)

To find the fifth largest salary, use the following query:

select SALARY from emp e1 where (5-1) = (select count(distinct
(e2.SALARY)) from emp e2 where e2.SALARY>e1.SALARY)

October 16, 2012 at 1:33 AM

select * from(select rownum r,ename,sal from(select * from emp order by sal desc))where r=5;


October 10, 2012 at 3:34 PM

select salary from employee order by salary desc limit 2,1









Related Tutorials/Questions & Answers:
3rd&5th highest salary from a table
3rd&5th highest salary from a table  how we get 3rd highest and 5th highest salary from a table
JDBC : Find Highest salary
(salary) FROM employee Employee Table :  - Example : In the following...JDBC : Find Highest salary In this tutorial, we are showing how to find record of highest salary employee. MAX() : MAX() method returns the highest
Advertisements
JDBC : Find second highest salary
JDBC : Find second highest salary In this section you will learn how to get record of employee having second highest salary. Find second highest salary : For finding the highest salary you can directly use MAX(salary) function
JDBC : Find Third highest salary
JDBC : Find Third highest salary In this section you will learn how to get record of employee having second highest salary. Find Third highest salary : For finding the highest salary you can directly use MAX(salary) function
query to fetch the highest record in a table
query to fetch the highest record in a table  Write a query to fetch the highest record in a table, based on a record, say salary field in the empsalary table
Which BSc course has highest salary?
Which BSc course has highest salary?  Hi, I am beginner in Data...: Which BSc course has highest salary? Try to provide me good examples or tutorials links so that I can learn the topic "Which BSc course has highest salary
Which job has highest salary in India?
Which job has highest salary in India?  Hi, I am beginner in Data...: Which job has highest salary in India? Try to provide me good examples or tutorials links so that I can learn the topic "Which job has highest salary
read a positive real numbers from highest to lowest
read a positive real numbers from highest to lowest  write a java program that will read a sequence of 10 positive real nos. entered by the user and will print the same numbers in sorted order from lowest to highest using arrays
JDBC : Find Lowest salary
= SELECT MIN(salary) FROM employee Employee Table :  - Example... of lowest salary in table employee. MIN() : MIN() method returns... = conn.createStatement(); String sql = "SELECT * FROM employee WHERE salary
retrieve record from table
retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually
mysql select into table from another table example
mysql select into table from another table example  Can you suggest the correct example of select into table from another table example in MySQL... from one table into another table. Check the example at MySQLselect into new
Mysql From Table
Mysql From Table       Mysql From Table is used to specify the table from which the records... from 'Mysql From Table'. To grasp this example we create  a table 'Stu
update one table from another table
update one table from another table  hello, i need to update one table fields by using another table fields. I have to tables Products.... for example TotalQuantity field from Products table should be updated if i
delete row from a table in hibernate
delete row from a table in hibernate  is there method to delete row in a table using hibernate like save(-) to insert row
Salary and overtime
Salary and overtime  Prompt the user for name and salary and calculate the overtime pay
Total summay from a sale table
Total summay from a sale table  Total summay from a sale table
JDBC : Salary greater than average salary
query - ADS_TO_REPLACE_1 sql = "SELECT * FROM employee WHERE salary >(SELECT AVG(salary) FROM employee)" Employee Table :  - Example... WHERE salary > (SELECT AVG(salary) FROM employee)"; rs
Retrieve Value from Table - Hibernate
Retrieve Value from Table   Hai friend, I need help, How can i retrieve values From database using hibernate in web Application. As I new to hibernate I couldn't find solution for this problem.. Can anyone help please.. 
retrieve record from the field table
retrieve record from the field table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
How to retrieve record from table
How to retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
air_Salary
a salary plan for its employees. In the new Policy, bonus is based on the fact that one... called Salary. (b.) Create methods/functions that will calculate i. the tax which is 5% of the gross salary ii. Bonus depending on the status of employee
Retrieving the Image from a database Table
Retrieving the Image from a database Table Consider a case where we want... to retrieve the image from the database table. You can do it very easily after... from the database table our java program need to make a connection
to upload a table from DB to the same html page
to upload a table from DB to the same html page  how to make this booklist table to be opened in the same html page itself using a third frame
How you will Show all data from a table.
How you will Show all data from a table.   How you will Show all data from a table.   Hi, following query is used to show all the data of the table-ADS_TO_REPLACE_1 SELECT * FROM tablename; Thanks
retrieve the records from one table to another table by using cursors
retrieve the records from one table to another table by using cursors  ... from one table to another table by using cursors.The following is my procedure and tables.After execution it insert one extra record to another table. empproc
deleting all records from a table in mysql
deleting all records from a table in mysql  Hi, I am finding code for deleting all records from a table in mysql. How to delete all rows in mysql...; This will delete all the records from the table. But if you are using auto
deleting all records from a table in mysql
deleting all records from a table in mysql  Hi, I am finding code for deleting all records from a table in mysql. How to delete all rows in mysql...; This will delete all the records from the table. But if you are using auto
Retrieve database from the table dynamically in jsp from oracle using servlet
Retrieve database from the table dynamically in jsp from oracle using servlet  Sir, I have created a table in oracle using eclipse, and added few columns dynamically. I want to retrieve the table with all columns dynamically
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want... table 1 to 10. Please suggest online example related to creating multiplication table. Thanks   Hi, Did you want to create multiplication table 1
Delete a Column from a Database Table
Delete a Column from a Database Table   ... to delete a column from a database table. We are not going to create a new table... a column from a database table then we have been provided with the  database
copying data from one table to another
copying data from one table to another  i need to copy data from one table to another table.. i.e the 1st eid of employee table must be copied to the 1st eid in appusers table, 2nd eid of employee to the 2nd eid of appusers
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
how to display a table from database using servlet
how to display a table from database using servlet  how to display a table with values from servletpage   Hi Friend, Please go through the following link:ADS_TO_REPLACE_1 http://roseindia.net/jsp/servlet-jsp-data
Fetch user records from a table in database
Fetch user records from a table in database  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
retrieve record from table and show it in HTML
retrieve record from table and show it in HTML  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
fetch record from MYsql table query
fetch record from MYsql table query  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
Write a query to delete a record from a table
Write a query to delete a record from a table  Write a query to delete a record from a table   Hi, The query string for the delete operation is as follows-ADS_TO_REPLACE_1 delete from employee where id='35'; Thanks
delete row from a table using hibernate
delete row from a table using hibernate  //code in java file String hql="delete from CONTACT c where ID=6"; Query query=session.createQuery... [delete from CONTACT] int i=query.executeUpdate
Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able to.... i am only able to retrieve one value not more than that. means in my
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want... created 12 tables with table name - month1,month2,....,upto month12.. each table... FROM ( SELECT * FROM month1 UNION ALL SELECT * FROM month2 UNION ALL
I have to retrieve these data from the field table
I have to retrieve these data from the field table  Hi. I have... chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
HTML & MYSQL - retrieve record from table
HTML & MYSQL - retrieve record from table  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single
MYSQL retrieve record from Data table
MYSQL retrieve record from Data table  Hi. I have a field in database...,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single
Deleting a Table from Database
Deleting a Table from Database       Imagine a situation where we need to delete a table from.... In this section we are describing, how to delete a table from database using java methods
Extracting table from Access Database to Servlet
Extracting table from Access Database to Servlet  Sir, I have a table with 4 field deptid, headid, normalexpend and projectexpend. Now I have... show 900. I have written the query as : Select sum(h1) from expend where head_id
How to Display values from databse into table
How to Display values from databse into table  I want to display values from database into table based on condition in query, how to display... enter either bookname or authorname and click on search button the values from
Deleting All Rows From the database Table
From the database Table      ... helps us to write on the browser. To delete all the rows from our database table... the PreparedStatement object. If the rows has been deleted from the database table
select maximum from table and hoe to store it in any variable
select maximum from table and hoe to store it in any variable  public..."); } } } i want to select max(sn) from table then insert into table...=request.getParameter("salary"); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
Retrieving Data from the table using PreparedStatement
Retrieving Data from the table using PreparedStatement... to fetch the data from the database in the table from our java program using... the getWriter() method of the PrintWriter class. We can retrieve the data from
retrieve Dept Name from table dept and retrieve list of employee from emp table for that dept in combobox
retrieve Dept Name from table dept and retrieve list of employee from emp table... the same input paramter then its should retrieve the data from another table... table dept(select deptno,deptname from dept where deptno=10) and retrieve list

Ads