Leetcode: 627 - UPDATE, SET, if
題目:
思路:
先看UPDATE的語法格式:
UPDATE 表名稱 SET 列名稱 = 新值 WHERE 列名稱 = 某值
IF 語法格式:
IF(expr1, expr2, expr3)
如果expr1 是 TRUE (expr1 <> 0 and expr1 <> NULL), 則 IF() 的返回值為 expr2;
否則返回值則為expr3.
程式碼:
UPDATE salary
SET sex = if(sex = 'm', 'f', 'm')
結果:
如果有什麼好方法,請留言告訴我吧~~
覺得不錯,就點贊或者關注~ ~
謝謝~ ~
相關文章
- Oracle Grid Infrastructure Patch Set Update 11.2.0.4.3OracleASTStruct
- UPDATE SET = (SELECT ) 語法的總結
- Leetcode Set Matrix ZeroesLeetCode
- MySQL update ...set後的and寫法的邏輯MySql
- LeetCode 73 Set Matrix ZeroesLeetCode
- Leetcode-Set Matrix ZeroesLeetCode
- Set Matrix Zeroes leetcode javaLeetCodeJava
- Leetcode 73. Set Matrix ZeroesLeetCode
- leetcode學習筆記73 Set Matrix ZeroesLeetCode筆記
- Oracle 11G OCP 1Z0-053 627Oracle
- MySQL中UPDATE語句裡SET後使用AND的執行過程和結果分析MySql
- Oracle PSU (Patch Set Update)- 10g補丁列表及如何檢視補丁Oracle
- Windows Update與Microsoft UpdateWindowsROS
- for update和for update nowaitAI
- FOR UPDATE NOWAIT和 FOR UPDATEAI
- for update 和 for update of 有什麼區別
- update restartREST
- mysql update join優化update in查詢效率MySql優化
- Oracle中的for update 和 for update nowaitOracleAI
- Set
- set /?
- lombok get/set 與 JavaBean get/setLombokJavaBean
- 關於 select ... for update 和 for update nowaitAI
- (轉)資料庫oracle for update of和for update區別資料庫Oracle
- SQL__UPDATESQL
- select for update
- windows 10 updateWindows
- MyBatis Batch Update Exception使用foreach批量update出錯MyBatisException
- SET NEWNAME FOR
- set -e
- Jet Set
- Vue.set與vue.$set的使用Vue
- set pause on,set pagesize N小知識點。
- [Javascript] Perform Set Operations using JavaScript Set MethodsJavaScriptORM
- pod update -- Failed to connect to GitHub to update the CocoaPods/Specs specs repoAIGithub
- select for update nowait 與 select for update 區別AI
- Default Locking for INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE (351)delete
- Sql server with as update用法SQLServer