what is syntex second or third highest salary.


thanks & Regards
Dhirendra sinha

Answer Posted / vikas kant

---To get 2nd highest salary----

select Top 1 salary from Emp where marks in(select top 2
salary from Emp order by salary desc)

---To get 3rd highest salary----

select Top 1 salary from Emp where marks in(select top 3
salary from Emp order by salary desc)



Regards Vikas Kant

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is after dml trigger?

763


What are the security related catalog views? : sql server security

703


When a primary key constraint is included in a table, what other constraints does this imply?

766


What is a transact-sql statement batch in ms sql server?

670


Explain database normalization?

873






What happens if null values are involved in bitwise operations?

796


Explain iaas, paas and saas?

86


what is the main function of a query parameter?

126


Write a program to fetch first 10 records from a file?

759


How to use wildcard characters in like operations in ms sql server?

809


Which are the new data types introduced in sql server 2008?

673


List the different types of collation sensitivities in sql server?

729


Explain what is scheduled job and how to create it?

716


How extra digits are handled with numeric data type literals?

695


How can we rewrite sub-queries into simple select statements or with joins?

710