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 / ravin

Buddies, why are you all selecting from and updating the
tables. The question says, just two variables to be swapped
without using any extra variable and also with a single
statement.
And Ramakanth's answer is right i.e. y=x+y-(x=y) . Thats it.

^^x contains 1,2 - didn't understand though.

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is recursive stored procedure? : Sql dba

529


Define sql delete statement.

566


What are conditional predicates?

587


What is difference between inner join and cross join?

522


How to sort the rows in sql.

603






What does sign mean sql?

573


What is an ndf file?

534


What is clustered index sql?

506


What is data control language (dcl)?

601


Can we debug stored procedure?

525


What are basic techniques of indexing?

846


What mean sql?

583


What is the current version of postgresql?

558


What is a natural join sql?

513


How do we use distinct statement? What is its use?

552