“n -й высочайшая зарплата в SQL” Ответ

n Высокая зарплата в SQL

SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP N salary
FROM #Employee
ORDER BY salary DESC
) AS temp
ORDER BY salary
Clumsy Cockroach

SQL 2 -я высокая зарплата

select *from employee 
group by salary 
order by  salary desc limit 1,1;
Zealous Zebra

n -й высочайшая зарплата в SQL

Here is the solution for nth highest
salary from employees table 

SELECT FIRST_NAME , SALARY FROM 
(SELECT FIRST_NAME, SALARY, DENSE_RANK() OVER
(ORDER BY SALARY DESC) AS SALARY_RANK
FROM EMPLOYEES)
WHERE SALARY_RANK = n; 
Obedient Ocelot

Первая максимальная зарплата в SQL

SELECT first-name
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);
Obedient Ocelot

n -й высочайшая зарплата в SQL

-- creating Employee table in Oracle
CREATE TABLE Employee (name varchar(10), salary int);

-- inserting sample data into Employee table
INSERT INTO Employee VALUES ('Rick', 3000);
INSERT INTO Employee VALUES ('John', 4000);
INSERT INTO Employee VALUES ('Shane', 3000);
INSERT INTO Employee VALUES ('Peter', 5000);
INSERT INTO Employee VALUES ('Jackob', 7000);

/*
SELECT TOP 1 salary 
FROM (
  SELECT DISTINCT TOP N salary FROM Employee ORDER BY salary DESC 
  ) AS temp 
ORDER BY salary
*/

SELECT TOP 1 salary 
FROM (
  SELECT DISTINCT TOP 1 salary FROM Employee ORDER BY salary DESC 
  ) AS temp 
ORDER BY salary


SELECT TOP 1 salary 
FROM (
  SELECT DISTINCT TOP 2 salary FROM Employee ORDER BY salary DESC 
  ) AS temp 
ORDER BY salary

SELECT TOP 1 salary 
FROM (
  SELECT DISTINCT TOP 3 salary FROM Employee ORDER BY salary DESC 
  ) AS temp 
ORDER BY salary
Tiny Coders

Зарплата 3 -го высоты SQL

SELECT MIN(EmpSalary) from ( 
	SELECT EmpSalary from Employee ORDER BY EmpSalary DESC LIMIT 3 
);
Nice Newt

Ответы похожие на “n -й высочайшая зарплата в SQL”

Вопросы похожие на “n -й высочайшая зарплата в SQL”

Больше похожих ответов на “n -й высочайшая зарплата в SQL” по Sql

Смотреть популярные ответы по языку

Смотреть другие языки программирования