Consider a table with 8 rows 4 rows contains value 0 and 4
rows contains value 1.Now write a single update query to make
all 0's as 1 and all 1's as 0

Answer Posted / shaheem ck

UPDATE <tablename>
SET <columnname> = DECODE(<columnname>,0,1,
1,0,
<columnname>);

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the disadvantages of indexes?

524


How to remove duplicate rows from table except one?

564


What happens if ntwdblib.dll is missing on your machine?

629


What is the difference between migration and upgradation in sql server?

598


How you can add messages to the nt event log from within a stored procedure?

563






How to achieve Paging of records in SQL SERVER?

588


Does view occupy space?

507


What is user defined stored procedures?

559


which table keeps the locking information? : Sql server administration

509


How to change the system date and time from SQL Plus Terminal ?

675


Difference between Inner vs outer joins?

528


What is the default sql server instance name?

554


Can you name some of the dml commands in sql?

544


How to provide default values to stored procedure parameters?

568


What is faster join or union?

593