two tables are there.1st table EMP has two columns ID and name and contains data 1,A
2,B
3,C
2nd table EmpSal has 2 columns ID and Salary
Contains data -1,1000
2,5000
3,3000
Find name of employee having maximum salary ?
Answer Posted / kanagavel
with cte
as
(
SELECT name,max(sal) as 'sal'
from emp1 inner join empsal
where emp1.id=empsal.id
group by name
)
select top 1 *
from cte
order by sal desc
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the ‘fillfactor’?
How to move database physical files in ms sql server?
Can you change the data type of a column in a table after the table has been created? If so, which command would you use?
What do you understand by triggers?
Can you move the resources after pausing the node? : sql server database administration
How to get nth highest salary from employee table.
Can a database be shrunk to 0 bytes, if not, why?
What is exclusive locks?
What is row-level compre?
Do you know what is similarity and difference between truncate and delete in sql?
When columns are added to existing tables, what do they initially contain?
What is data source in connection string?
How to add the custom code in Report?
Which tools are available to manage SQL Azure databases and servers?
What is BCNF? How is it better than 2NF & 3NF?