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
Why indexing is needed?
How global cursor can be declare with dynamic trigger ?
how to create a new table by selecting rows from another table in mysql? : Sql dba
What are all ddl commands?
What is normalization in a database?
Explain architecture of sql server notification services?
can sql servers linked to other servers like oracle? : Sql dba
Lookups are a key component in sql server integration services (ssis). Explain its purpose?
What is the purpose of cursors in pl/sql?
How can we solve sql error: ora-00904: invalid identifier?
What is procedure explain with program?
How many types of index are there?
What is sqlcommand?
What is view explain with example?
Which is faster truncate or drop?