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


Please Help Members By Posting Answers For Below Questions

What is trigger price?

534


How many row comparison operators are used while working with a subquery?

529


What makes a good primary key?

515


What are the 3 modes of parameter?

675


how do you login to mysql using unix shell? : Sql dba

559






Can a foreign key be null?

579


How do you exit in sql?

581


What is difference between my sql and sql?

526


Why is a trigger used?

519


How do I know if I have sql express or standard?

591


How can you get sql*loader to commit only at the end of the load file? : aql loader

545


What does joining a thread mean?

540


What is the difference between count 1 and count (*) in a sql query?

491


How do I run a sql query?

528


What is the meaning of disabling a trigger?

643