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 |
Explain the concept of normalization.
Is record in oracle pl sql?
I want to execute a piece of code before calling a procedure. How to achieve it?
What does truncate mean in sql?
What is delete command in sql?
Explain the methods used to protect source code of pl/sql.
What is a trigger word?
How to retrieve Duplicate Rows only in a Table? Suppose if a Table Name is "Education". It consists of multiple columns. Then if we insert rows into this table with duplicate records then how can we retrieve only duplicate records from that table?
28 Answers Alps, Aricent, Bank Of America, Wipro,
Is ms sql traffic encrypted?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
Which one of the following is a reason that an INSERT statement might cause an error instead of executing correctly? 1. The INSERT statement was attempting to insert a record into a view that was created from more than one table. 2. The INSERT statement was attempting to insert a record using a combination of constants and values from an existing table. 3. The INSERT statement was attempting to insert a record with a non-NULL value into a table that has that column defined as NULL. 4. The INSERT statement was attempting to insert a record into a table by selecting a record from that same table. 5. The INSERT statement was attempting to insert a record into a view rather than a table.
Do stored procedures prevent sql injection?