wat will be the sql query to extract only last 3 records
from table supose table hving thousands for records
Answer Posted / kumar
You will be do following things one by one in sql server.
first create table.
1.create table tablename(sno int identity(1,1) primar key,
names varchar(100))
insert the record one by one.
2.
Insert into tablename(names) values ('arun')
Insert into tablename(names) values ('arun')
Insert into tablename(names) values ('arun')
Insert into tablename(names) values ('arun')
.
.
.
.
To Insert 1000 record one by one.
Then to execute the following query to get last 3 record.
select top 3 * from tablename
order by 1 desc
you will be get the correct answer ok.
By
kumar
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Characterize join and name diverse sorts of joins?
How to call a function from a stored procedure in SQL Server ?
What is sql server profiler?
Why I have to use stored procedures?
If a stored procedure is taking a table data type, how it looks?
What is the difference between inner join and equi join?
Why normalization is used?
What is nolock hint in sql server 2008
How to see the event list of an existing trigger using sys.trigger_events?
What is the use of sign function?
Explain alternate key, candidate key and composite key in sql server?
Explain what are magic tables in sql server?
How to drop an existing table with "drop table" statements in ms sql server?
What is a unique key constraint?
What are the differences between substr and charindex in sql server.