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



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


venky
3rd&5th highest salary from a table
3 Answer(s)      3 years and 9 months 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 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
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
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
Salary and overtime
Salary and overtime  Prompt the user for name and salary and calculate the overtime pay
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 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... 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 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
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.. 
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 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
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
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
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
Advertisements
 

 

 

DMCA.com