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 / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different joins used in sql?

636


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

671


Write the command to remove all players named sachin from the players table.

826


How to connect a sql*plus session to an oracle server?

729


what is a materialized view? : Sql dba

665






What is sql rowcount?

651


What is t sql in sql server?

661


What is sql and how does it work?

643


Can we update views in sql?

611


When is the explicit cursor used ?

672


What are analytic functions in sql?

650


How to use distinct and count in sql query? Explain

696


What sql does db2 use?

646


What is row_number () in sql?

634


Why coalesce is used in sql?

565