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
when MSQL8.0 is in market
Is sql similar to python?
What is the usage of the distinct keyword?
What are types of indexes in sql?
what is index? : Sql dba
What is type and rowtype in pl sql?
What is the difference between a database and a relational database?
What are different types of sql commands?
How show all rows in sql?
how to start mysql server? : Sql dba
what are date and time functions in mysql? : Sql dba
how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba
Why do we need pl sql?
What is write ahead logging in sql server?
What is plpgsql language?