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


Please Help Members By Posting Answers For Below Questions

What stored procedure would you use to view lock information?

519


What is index, cluster index and nonclustered index?

509


What is difference between commit and rollback when used in transactions?

488


Describe in brief sql server monitoring ways.

583


This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?

2010






How do use Having,Group by,Group function in SQL?

1351


What are built in functions?

570


Can you create a logon trigger in sql server 2005 express edition?

568


What is normalization? Describe its different types.

578


What do you understand by the analysis services in sql server?

531


What is the user of Primary key?

575


What is subreport?

96


Write an sql query to find first weekday of the month?

479


What are the ways available in sql server to execute sql statements?

564


What are the purposes of floor and sign functions?

530