Given a Student table, Swap all Male to Female value and vice versa with a single update query.
Id Name Sex Salary
----------------------------
1 Ranga Male 2500
2 Vasu Female 1500
3 Raja Male 5500
4 Amma Female 500
Program:
------------------------
UPDATE Gender SET sex = CASE sex WHEN 'Male' THEN 'Female' ELSE 'Male' END
Sunday, May 17, 2015
Home »
Interview Questions
,
MySQL
,
Programs
,
SQL
» Write a SQL Program to Swap the values in a single update query.
0 comments:
Post a Comment