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 / madhu sudhan g
Hiii Lets take a table Test contains one field No having 8
rows in that 4 rows are with 0's and 4 rows with 1's to update
Update Test
SET No=case when 1 then o
else 1
ENd
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How many cores do I need for sql server 2016?
Explain view in sql server?
How to insert a new row into a table with "insert into" statements in ms sql server?
Can the “if update (colname)” statement be used in a delete trigger?
How to see the event list of an existing trigger using sys.trigger_events?
If you lose rights to your sql server instance what are the options to connect to sql server instance? : sql server security
Write a SQL query to make a column as unique?
What is a sql join?
Write an sql query to find first weekday of the month?
What is delete query?
What is the default sql server instance name?
Can you explain about buffer cash and log cache in sql server?
What are scalar functions in sql?
As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?
What’s the use of custom fields in report?