Q1. You have 3 tables, employee, employee details and employee salary. Write a query to get the max salary among all employees without using the max keyword.
Q2. select first and last row from a table?
Q2. select first and last row from a table?
=================================================================================
=================================================================================
Q2. select first and last row from a table?
Answer:
declare @count int;
select @count = Count(1) from Projects;
with Cte as
(
select *, ROW_NUMBER() over (order by projectID desc) as rownum from Projects
)
select * from Cte where rownum =1 or rownum = @count
=================================================================================
=================================================================================
=================================================================================
=================================================================================