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

how to create a new table in mysql? : Sql dba

720


Name the different types of indexes in sql and define them.

791


how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba

1086


How to select random rows from a table?

734


what is the bond code in materialized view?

2686






Explain what is a subquery ?

856


What is the importance of sqlcode and sqlerrm?

1058


what are tables and fields? : Sql dba

771


What is pls integer?

781


Why do we use subquery?

703


How much does a sql dba make? : SQL DBA

674


What are the three forms of normalization?

763


What is the difference between a primary key and a unique key?

754


Why do we need unique key in a table?

673


How is sql used in oracle?

756