Write a query to get all details of employee who has maximum
salary from employee table

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is partition index in sql server?

602


What is the Control Flow in SSIS

568


How many levels of sp nesting is possible?

576


Why should one not prefix user stored procedures with ‘sp_’?

586


Can an entity have two primary keys?

517






How to create a view with data from multiple tables?

555


What is the use of =,==,=== operators?

567


Explain transaction server distributed transaction?

496


How do you delete duplicate rows in sql server?

500


hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.

2461


What are the requirements for sql server 2016?

531


how to control the amount of free space in your index pages? : Sql server database administration

596


What command is used to create a database in the sql server and how?

595


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

600


How to achieve Paging of records in SQL SERVER?

589