Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL 3rd&5th highest salary from a table

Have Programming Question? Ask it here!
 
 
 


venky
3rd&5th highest salary from a table
3 Answer(s)      3 years and a month ago
Posted in : SQL


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


Advertisement
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
JDBC : Find Highest salary In this tutorial, we are showing how to find record of highest salary employee. MAX() : MAX() method returns the highest... just use MAX method in your query as - sql = SELECT MAX(salary) FROM employee
Advertisements
JDBC : Find Third highest salary
to get third highest salary. Employee Table :  - Example...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
JDBC : Find second highest salary
to get second highest salary. Employee Table :  - Example...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
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
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
of lowest salary in table employee. MIN() : MIN() method returns...) FROM employee Employee Table :  - Example : In the following example... sql = "SELECT * FROM employee WHERE salary=(SELECT MIN(salary) FROM employee
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
JDBC : Salary greater than average salary
query - sql = "SELECT * FROM employee WHERE salary >(SELECT AVG(salary) FROM employee)" Employee Table :  - Example : Here is an example...(); String sql = "SELECT * FROM employee WHERE salary > (SELECT AVG
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 From Table
Mysql From Table       Mysql From Table is used to specify the table from which the records... for From The keyword 'from' is used to specify the table 'Stu' from which records
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
Total summay from a sale table
Total summay from a sale table  Total summay from a sale table
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
how to calculate salary of all the employees 10%extra then actual salary - SQL
how to calculate salary of all the employees 10%extra then actual salary  how to calculate salary of all the employees 10% extra then actual... the total salary of a single employee. In the same way, you can calculate salary
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
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
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- SELECT * FROM tablename; Thanks
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- delete from employee where id='35'; Thanks
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
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
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
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
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
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
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: http://roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
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
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
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
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
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
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
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
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
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
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...() method of the PrintWriter class. We can retrieve the data from the database only
Select data from Table in Database
Select data from Table in Database   ... the selected data from table in database. The select query in the database retrieve...; in simple select statement is given below select column name from table
how to display nth greatest salary - SQL
how to display nth greatest salary  how to display nth greatest salary
Retrieving Data from the table using Statement
Retrieving Data from the table using Statement  ... to fetch the data from the database in the table from our java program.  ... to retrieve the data from the table so we need to write a query to select all
Deleting All Rows from a Database Table
Deleting All Rows from a Database Table   ... database table, now we have to delete all the rows from the table. This section describes for deleting all rows from a specific database table. Deleting all rows
How do we create new table apart from mapping with existing table ?
How do we create new table apart from mapping with existing table ?  Hi, How do we create new table apart from mapping with existing table ? Thanks
determine the top 10 highest and 10 lowest in java
determine the top 10 highest and 10 lowest in java  hello, I have a case, where there are tables in the database and have a file borrowing that contains the codebooks and namesmembers. I want to make 10 the highest rank anyone
 

 

 

DMCA.com