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)

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / avi007

select A as "B",B AS "A" from T;

Is This Answer Correct ?    1 Yes 2 No

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

Answer / lova raju allumalla

update T set A=B,B=A where A in (select A from T);

Is This Answer Correct ?    1 Yes 2 No

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

Answer / amit

UPDATE T
SET A = B, ENVDOR_NUMBERB = A

Is This Answer Correct ?    1 Yes 4 No

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

Answer / preeti mishra

update T
set A:=A+B,
B:=A-B,
A:=A-B;

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

How do I run a program in pl sql?

0 Answers  


What are different types of functions in sql?

0 Answers  


How to select all records from the table?

0 Answers  


what is the difference between myisam static and myisam dynamic? : Sql dba

0 Answers  


How do rank () and dense_rank () differ?

0 Answers  


What do you mean by dbms? What are its different types?

0 Answers  


What are the three forms of normalization?

0 Answers  


Can we write create command in the plsql block?if possible how?

2 Answers  


What are the types of queries in sql?

0 Answers  


How to call the function and Procedure in trigger?

3 Answers   IBM,


what is user defined functions? : Sql dba

0 Answers  


what is the forward decleration in packages?

1 Answers  


Categories