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 / b.kumar
--BY USING MS SQL SERVER
SELECT TOP 1 * FROM
(SELECT DISTINCT TOP 1 #A.ID,#A.NAME,#B.SAL
FROM #A INNER JOIN #B ON #A.ID=#B.ID ORDER BY SAL) E
ORDER BY SAL
--HERE #A, #B ARE TEMP TABLES
--E IS ALIAS NAME
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to perform key word search in tables?
What is scrollable cursor?
What is the difference between a function and a stored procedure?
Define self join?
Can you name some of the dml commands in sql?
What is the difference between delete and truncate statements?
What stored procedure can you use to display the current processes?
What is a transactions?
what is spatial nonclustered index
What is cube dimension? : sql server analysis services, ssas
How to select true false based on column value in sql server?
How can we check the sql server version?
What is Dependency Injection and provide example?
What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?
What is the downside of using udf?