/ Programming / Database / Mysql /

Mysql 函數大全 - 控制流程函數

New Subject
Random
Previous
Next
|
Mysql 函數大全 - 控制流程函數

a) CASE WHEN THEN 函數

語法: CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ……] [ELSE result ] END CASE WHEN [condition] THEN result [WHEN[condition] THEN result ……] [ELSE result] END ;

函數用法說明:在第一個方案的返回結果中, value =compare-value 。而第二個方案的返回結果是第一種情況的真實結果。如果沒有匹配的結果值,則返回結果為 ELSE 後的結果,如果沒有 ELSE 部分,則返回值為 NULL

b)IF 函數用法

語法: IF(expr1,expr2,expr3)

函數用法說明:如果 expr1 是 TRUE (expr1 <> 0 and expr1 <> NULL) ,則 IF() 的返回值為 expr2 ; 否則返回值則為 expr3 。 IF() 的返回值為數字值或字符串值,具體情況視其所在語境而定

c)IFNULL 函數

語法: IFNULL(expr1,expr2)

函數用法說明:假如 expr1 不為 NULL ,則 IFNULL() 的返回值為 expr1 ; 否則其返回值為 expr2 。 IFNULL() 的返回值是數字或是字符串,具體情況取決於其所使用的語境

  • This is a reposted article.
  • Keywords : expr1, result, value, 函數用法, expr2, IFNULL, 語法, compare, 返回值為, 返回, 方案, 函數, expr3, condition, 部分, 返回值, 語境而定, 語境, 而第二, 第一種情況
0 0
2013-01-17T18:13:00+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Archive DIR

    Facebook Page

    QR-Code and APP Launcher

    User Guide
    This Webpage

    In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
    QRCode
    • Auto Platform
      For better browsing experience, it will auto detects your device to display webpage.
    • Bug Report
      Tell us about the idea, problem and errors you found.
    • Comodo Secure
      The sensitive data transmission adopts by SSL-2048 authenticated encryption.
    • Copyright
      © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
    • Revised Version
      V2.2.207
      06 Jan 2025 (GMT+8)