How to find out the second largest element from mysql table
Answers were Sorted based on User's Feedback
Answer / neelesh jain
LIMIT <n> == n rows will be returned
OFFSET <n> == skip n rows of the query result
SELECT Salary FROM Employee ORDER BY Salary DESC LIMIT 1
OFFSET 1;
so above query skip 1 element (as offset is 1), which is
biggest and returned 1 elemetn which is 2nd largest value.
| Is This Answer Correct ? | 0 Yes | 0 No |
SELECT salary
FROM employees
ORDER BY salary DESC
LIMIT 2,1
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / prashant chaudhary
select top 1 * from ( select top 3 * from Student_Info
order by marks desc)table1 order by marks
| Is This Answer Correct ? | 5 Yes | 6 No |
Answer / shanmukha
select min(salary) from Employee where salary in(select
distinct top 2 salary from Employee order by salary desc )
This is the query to find second maximum salary in MSSQL
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sivsankar.ponnurangam
select project_id from tbl_project order by project_id
desc limit 2,1
| Is This Answer Correct ? | 21 Yes | 42 No |
How do you know the version of your mysql server?
Is mysql free software?
What are the advantages of mysql?
Write a query to fetch common records between two tables using mysql?
What are string data types?
How do I backup mysql database on linux?
What is database migration in mysql?
why we are join a tow table
How do I view data in mysql workbench?
How do I install mysql on windows 10 64 bit?
What is mysql data directory? How to determine the location of the data directory?
Consider you have a composite index of three columns. Now, you have to provide the value of two columns in the where clause of a select query. Do you think index can be used for the operation?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)