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

Why de-normalization required?

1051


Do you know what is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?

1049


What is ms sql server triggers?

1066


When to use Inner join & when to use subquery?

1231


What is transaction server isolation?

1089


How to delete duplicate rows from table except one?

1037


What is the difference between functions and scalar functions?

1274


What is a join in sql?

1149


What is checkpoint in sql server?

1211


Explain about SQLOS?

1053


Tell me what is the significance of null value and why should we avoid permitting null values?

1038


What is the rdl file?

141


What are the properties of the relational tables?

924


How to update values in a table with update statements in ms sql server?

1059


How to list all field names in the result set using mssql_field_name()?

951