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

What are different clauses used in sql?

709


What is sql basics?

690


Why select is used in sql?

605


What is the difference between local and global temporary table?

652


Why left join is used in sql?

632






Can instead of triggers be used to fire once for each statement on a view?

629


what are the different index configurations a table can have? : Sql dba

669


What is difference between stored procedure and trigger?

643


Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints

748


How many types of index are there?

642


Does sql use python?

666


what is data integrity? : Sql dba

687


What is nosql vs sql?

690


What are the different types of triggers?

674


Which is better trigger or stored procedure?

592