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 report builder?

106


Explain magic tables in sql server?

555


What is constraints and its types?

504


What happens when transaction log is full?

515


What is oltp (online transaction processing)?

587






What is after dml trigger?

576


Explain microsoft sql server functions?

546


Explain timestamp datatype?

554


How do I view a script in sql server?

540


Why we use trigger in sql server with example?

514


What is the fillfactor concept in indexes?

536


What is difference between joins and subqueries?

538


Issues related in upgrading SQL Server 2000 to 2005 / 2008

1505


Explain in brief about Microsoft SQL server?

549


Differentiate between SQL and ORACLE joins and write their syntax.

597