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 do you know the version of your mysql server? : Sql dba

502


What are all the ddl commands?

621


Explain character-manipulation functions?

622


Can a table contain multiple foreign key’s?

566


How do I remove sql plus from windows 10?

562






How do I count rows in sql query?

487


How can I get the number of records affected by a stored procedure?

567


How do I add a database to sql?

570


What are the ddl commands?

530


How can I change database name in sql?

522


What is auto increment in sql?

579


What is difference between ms sql and mysql?

474


What are the sql commands?

601


How insert into statements in sql?

586


What is difference between group by and partition by?

492