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
how many triggers are allowed in mysql table? : Sql dba
Why is partition used in sql?
Which one is better sql or oracle?
list out some tools through which we can draw e-r diagrams for mysql. : Sql dba
What is the difference between clustered and non-clustered index in sql?
What is pls_integer in pl sql?
Can we debug stored procedure?
What is use of trigger?
Can we use the cursor's to create the collection in PL/SQL?
how to create a new view in mysql? : Sql dba
What is sql server and ase?
What is sql select statement?
Do foreign keys improve performance?
What sql does db2 use?
What are different types of statements supported by sql?