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)
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
How do I run a program in pl sql?
What are different types of functions in sql?
How to select all records from the table?
what is the difference between myisam static and myisam dynamic? : Sql dba
How do rank () and dense_rank () differ?
What do you mean by dbms? What are its different types?
What are the three forms of normalization?
Can we write create command in the plsql block?if possible how?
What are the types of queries in sql?
How to call the function and Procedure in trigger?
what is user defined functions? : Sql dba
what is the forward decleration in packages?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)