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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain the difference between bool, tinyint and bit. : Sql dba

710


Which version of sql do I have?

749


Is left join same as join?

729


Explain what is a column in a table?

764


Which command is used to call a stored procedure?

713






What is offset in sql query?

822


What is a join?

809


What is record data type?

677


How many indexes can be created on a table in sql?

685


What are the different schemas objects that can be created using pl/sql?

729


Does sql view stored data?

722


Explain commit, rollback and savepoint.

766


what are the advantages of sql ? : Sql dba

739


Which normal form is best?

675


What does the base_object_type column shows in the user.triggers data dictionary view?

762