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
Is there a way to automate sql execution from the command-line, batch job or shell script?
What is embedded sql what are its advantages?
Why do we use sql constraints? Which constraints we can use while creating database in sql?
What is package in pl sql with an examples?
How do you delete a table?
column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.
Which is better varchar or nvarchar?
Is it possible to include an insert statement on the same table to which the trigger is assigned?
How delete all data from all tables in sql?
What is sql and its types?
What is compiled query?
What is user in sql?
what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba
How would you convert date into julian date format?
How do you pronounce sql?