How to select nth record from a table?
Answers were Sorted based on User's Feedback
Answer / ravinder pawar
Hi Frnds,
Pravin's logic is correct. I am just modifying it little
bit.
Select Top 1 *
From (Select Top 5 *
from HumanResources.Employee
order by EmployeeID desc)as temp
---Note If we don't use temp we'll get error as mentioned
below:
Incorrect syntax near ')'.
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / pravin s. ahire
Select Top 1 *
From (Select Top N * from tablename order by
table.ColumnName desc)
-- where N = nth record
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sajida
--For ex in dept table to select 5th record. Instead of
this you can use &n so that it can ask row number
select rnum, d.* from dept d, (select rownum rnum ,
deptno from dept ) e
where d.deptno = e.deptno and rnum = 5
Is This Answer Correct ? | 5 Yes | 10 No |
9. Write a query to list a new column with the difference in temp of the cities Delhi and Mumbai, Mumbai and Jammu and soon. Consider the following table : City_id City Temp. 1 delhi 40 2 Mumbai 35 3 Jammu 32 4 Pune 18
Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
How to list all user names in a database?
Do you think BCNF is better than 2NF & 3NF? Why?
Why we need sql server?
In which files does sql server actually store data?
What are the grouping functions?
What is the fastest way to permanently delete a 1 million row table named customers?
Define constraints and give an example of their use?
What are the character string functions supported by sql server 2005?
what are the joins,primary key,foriegn key, candidate key, super key and expain them?
Explain the working of sql privileges?