
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we fetch a second highest salary of an employee from a MySQL table?
To understand this concept, we are using the data from table ‘Salary’ as follows −
mysql> Select * from Salary; +--------+--------+ | Name | Salary | +--------+--------+ | Gaurav | 50000 | | Rahul | 40000 | | Ram | 45000 | | Raman | 45000 | +--------+--------+ 4 rows in set (0.00 sec) mysql> Select * from salary12345 order by salary DESC limit 1 offset 1; +-------+--------+ | name | Salary | +-------+--------+ | Raman | 45000 | +-------+--------+ 1 row in set (0.00 sec)
- Related Articles
- Find max and second max salary for a MySQL Employee table?
- Find max and second max salary for a MySQL Employee table using subquery?
- How can we fetch a particular row as output from a MySQL table?
- How can we fetch all the records from a particular MySQL table?
- How can we fetch alternate even-numbered records from MySQL table?
- How can we fetch alternate odd numbered records from MySQL table?
- How can we fetch one or more columns as output from a MySQL table?
- How can we create a table from an existing MySQL table in the database?
- How can we remove a column from MySQL table?
- Can we select second largest record from a table without using LIMIT clause in MySQL?
- Select highest salary in MySQL?
- How can fetch records from specific month and year in a MySQL table?
- How can we delete a single row from a MySQL table?
- How can we delete multiple rows from a MySQL table?
- How can we delete all rows from a MySQL table?

Advertisements