Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Characterize join and name diverse sorts of joins?

966


How to call a function from a stored procedure in SQL Server ?

1025


What is sql server profiler?

1001


Why I have to use stored procedures?

1034


If a stored procedure is taking a table data type, how it looks?

6439


What is the difference between inner join and equi join?

987


Why normalization is used?

1007


What is nolock hint in sql server 2008

1117


How to see the event list of an existing trigger using sys.trigger_events?

1071


What is the use of sign function?

1116


Explain alternate key, candidate key and composite key in sql server?

910


Explain what are magic tables in sql server?

988


How to drop an existing table with "drop table" statements in ms sql server?

1084


What is a unique key constraint?

1024


What are the differences between substr and charindex in sql server.

1107