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 recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?
What the different topologies in which replication can be configured?
What are the types of database recovery models?
What is row_number function?
What is the purpose of data source?
What is the synonym of join?
What is store procedure? How do they work? When do you use?
When columns are added to existing tables, what do they initially contain?
Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?
What are different types of statement?
How does Report Builder support Analysis Services cubes?
We need to perform what steps in the following order to work with a cursor?
What do you mean by SQL injection attack?
What is the primary use of the model database?
What is the difference between coalesce() & isnull()?