I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000
Answer Posted / chan
SELECT ID, SALARY FROM
(
SELECT ID, SALARY, ROW_NUMBER() OVER (ORDER BY SALARY) AS RN
FROM EMPLOYEE
)
WHERE RN = 1
(YOU CAN CHANGE VALUE OF RN = ANY NUMBER AND YOU WILL GET
THAT VALUE)
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
How to set the current database in ms sql server?
What is sql language?
What is the maximum size per database for sql server express?
Can we call future method from queueable?
Explain the use of keyword with encryption. Create a store procedure with encryption?
What are the options which must be set to allow the usage of optimistic models?
Give an example of why you would want to denormalize a database
Explain various data region available in ssrs with their use?
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?
How many types of keys are there?
Describe triggers features and limitations?
Explain the cursor lock types?
How to drop an existing schema in ms sql server?
What is normalization? What number of normalization shapes are there?