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 is sql and db2?

626


What does plv msg allows you to do?

785


Why partition by is used in sql?

641


Why we use stored procedure instead of query?

618


How to select random rows from a table?

634






What is on delete set null?

656


GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?

2671


What is a sql select statement?

673


What are hotfixes and patches?

622


What does desc stand for?

692


How to sort the rows in sql.

711


What is pl sql block structure?

636


What is normalisation and its types?

633


What are the advantages of pl sql?

721


Which are the different character-manipulation functions in sql?

625