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...

If I have a table T with 4 rows & 2 columns A & B. A has
values 1,2,3,4. and B has 10,20,30,40. Write an Update SQL
query which can Swap the values of A & B for all records.
(Do not use a sub-query)

Answer Posted / bunty

UPDATE T
SET A = B,B=A;

I am surprized but above query will fetch the desired
result.

Cheers,
Bunty

Is This Answer Correct ?    30 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are myisam tables? : Sql dba

1030


What is union and union all keyword in sql?

1031


Can delete statement be rollbacked?

984


Can we use joins in subquery?

1158


Is sql microsoft?

1045


Does sql backup shrink transaction log?

977


How to display the current date in sql?

1073


What is implicit cursor in pl sql?

1090


What is the use of prepared statement?

1010


Is mariadb a nosql database?

1045


What are sql procedures?

1019


What is the difference between partitioning and sharding?

1004


what is the functionality of the function htmlentities? : Sql dba

951


Can we use ddl statements in stored procedure?

1141


What is the purpose of the primary key?

1058