Write a query to get all details of employee who has maximum
salary from employee table
Answers were Sorted based on User's Feedback
Answer / krishh
SELECT max(salary) FROM Employee WHERE salary NOT IN (SELECT max(salary) FROM Employee);
| Is This Answer Correct ? | 23 Yes | 4 No |
Answer / vineet
Select * from EMP_TAB where salary = (select max(salary) from EMP_TAB;
| Is This Answer Correct ? | 8 Yes | 1 No |
select max(sal) from emp it will show max sal of
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / anil kumar prajapati
CREATE TABLE Employee_Test
(
Employee_ID INT,
Employee_name Varchar(100),
Employee_Salary Decimal (10,2)
);
INSERT INTO Employee_Test VALUES (1,'Anish',1000);
INSERT INTO Employee_Test VALUES (2,'Sushant',1200);
INSERT INTO Employee_Test VALUES (3,'Rakesh',1100);
INSERT INTO Employee_Test VALUES (4,'Manoj',1300);
INSERT INTO Employee_Test VALUES (5,'Amit',1400);
INSERT INTO Employee_Test VALUES (6,'Lokesh',1600);
INSERT INTO Employee_Test VALUES (7,'Maneneder',1400);
INSERT INTO Employee_Test VALUES (8,'Narendra',400);
INSERT INTO Employee_Test VALUES (9,'Kaushal',1900);
INSERT INTO Employee_Test VALUES (10,'Vikas',3400);
INSERT INTO Employee_Test VALUES (11,'Sudhir',800);
SELECT *FROM Employee_Test Emp1
WHERE ( n ) = (SELECT COUNT( DISTINCT (Emp2.Employee_Salary
) )
FROM Employee_Test Emp
WHERE Emp2.Employee_Salary >= Emp1.Employee_Salary
)
| Is This Answer Correct ? | 6 Yes | 4 No |
Answer / sureshramsing
select * from(select e.* from emp e order by sal desc) where rownum=1;
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / vj
with cte as
(
select row_number() over (order by employee_salary desc)
maxSal ,* from Employee_Test)
select * from cte where maxSal=1
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / mithilesh gatole
Answer -
SELECT FROM Employee Emp1 WHERE (N-1) = ( SELECT COUNT(DISTINCT(Emp2.Salary)) FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary)
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sureshramsing
select * from emp where (empno,1)=(select * from(select empno,row_number() over(order by sal desc) rn from emp) where rn=1);
| Is This Answer Correct ? | 0 Yes | 4 No |
Can sql servers link to other servers like oracle?
What is ms sql server service broker?
what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?
How many non clustered indexes there can be on table ?
How to modify the underlying query of an existing view?
can you any body tell me why are go for the rebuild the master database.what is the reason?
How to create and drop temp table in sql server?
What is Command line parameters in PLSQL.?
How do you know which index a table is using?
what is cursor?why we will go to cursor?advantages &disadvantages of cursors?
What are diverse clauses that form a part of sql?
What are the steps you will take to improve performance of a poor performing query?
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)