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


Please Help Members By Posting Answers For Below Questions

What is the maximum size of sql server database?

689


What is recompile sql server?

750


Explain what stored procedure sp_replcounters is used for? : sql server replication

1232


What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas

916


What is dbcc? Give few examples.

749






Mention the differences between local and global temporary tables.

736


what types of replication are supported in sql server? : Sql server database administration

656


What are subquery and its properties?

730


How many full-text indexes can a table have?

719


What is scalar user-defined function?

716


What is difference between joins and subqueries?

733


How to delete exactly duplicate records from a table?

803


What is the difference between commit and rollback?

670


What is exclusive locks?

700


Which sql server is best?

723