there are 2 variables called x and y ,x contains 1,2 and y
contains 3,4 we have to swap the values from x to y and y
to x with out using dummy variables and it can be done only
by using a single statement ? how?
Answer Posted / raji_4u
IF YOU WANT TO UPDATE THE TABLE,
UPDATE TABLE_NAME
SET X = Y, Y = X;
--------------------------
IF YOU WANT TO JUST DISPLAY,
SELECT Y X,X Y FROM TABLE_NAME;
ISN'T THIS SIMPLE THAN SANTHI.K DID.
Is This Answer Correct ? | 5 Yes | 7 No |
Post New Answer View All Answers
What is trigger price?
How many row comparison operators are used while working with a subquery?
What makes a good primary key?
What are the 3 modes of parameter?
how do you login to mysql using unix shell? : Sql dba
Can a foreign key be null?
How do you exit in sql?
What is difference between my sql and sql?
Why is a trigger used?
How do I know if I have sql express or standard?
How can you get sql*loader to commit only at the end of the load file? : aql loader
What does joining a thread mean?
What is the difference between count 1 and count (*) in a sql query?
How do I run a sql query?
What is the meaning of disabling a trigger?