Search
 
SCRIPT & CODE EXAMPLE
 

SQL

How to find third highest salary in 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 3 salary FROM Employee ORDER BY salary DESC 
  ) AS temp 
ORDER BY salary
Comment

first max salary in sql

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

PREVIOUS NEXT
Code Example
Sql :: how to get information about data types in postgreSQL 
Sql :: first mysql 
Sql :: changing column names in sql query results 
Sql :: postgresql having 
Sql :: pl sql search saurce code 
Sql :: where clause for clob in oracle 
Sql :: sql use with to get value counts and percentages 
Sql :: mysql default -temp password 
Sql :: sql not equal to operator 
Sql :: get from database the most recent data limit by 5 
Sql :: mysql grouping functions 
Sql :: Write a PL/SQL to print even numbers upto 100. 
Sql :: how to average max mysql 
Sql :: SQL SELECT TOP Equivalent in oracal 
Sql :: select all from table left join 
Sql :: postgresql get difference in hours between two dates 
Sql :: oracle INTERVAL DAY to second to number 
Sql :: postgresql array to rows 
Sql :: mysql delete duplicate rows except one 
Sql :: acual month sql 
Sql :: how to declare variable date in mysql 
Sql :: drop procedure postgres 
Sql :: three inner joins sql 
Sql :: oracle no data found error code 
Sql :: clone row from another table mysql 
Sql :: replace function in sql 
Sql :: alter rename command in mysql 
Sql :: drop specific row postgresql 
Sql :: how to start postgresql laravel 
Sql :: oracle procedure teamplate 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =