新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
mysql中case when語(yǔ)句的使用示例
下面為您舉例說(shuō)明了三種mysql中case when語(yǔ)句的使用方法,供您參考學(xué)習(xí),如果您對(duì)mysql中case when語(yǔ)句使用方面感興趣的話,不妨一看。

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專(zhuān)注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、小程序制作、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了南岳免費(fèi)建站歡迎大家使用!
1。
- select name,
- case
- when birthday<'1981' then 'old'
- when birthday>'1988' then 'yong'
- else 'ok' END YORN
- from lee;
2。
- select NAME,
- case name
- when 'sam' then 'yong'
- when 'lee' then 'handsome'
- else 'good' end
- from lee;
當(dāng)然了case when語(yǔ)句還可以復(fù)合
3。
- select name,birthday,
- case
- when birthday>'1983' then 'yong'
- when name='lee' then 'handsome'
- else 'just so so ' end
- from lee;
以上就是mysql中case when語(yǔ)句的使用示例的介紹。
【編輯推薦】
MySQL設(shè)置自增字段的方法介紹
常見(jiàn)MySql字段的默認(rèn)長(zhǎng)度
MySQL數(shù)值數(shù)據(jù)類(lèi)型的范圍
MySQL索引類(lèi)型介紹
mysql添加刪除主鍵的方法
網(wǎng)站名稱(chēng):mysql中case when語(yǔ)句的使用示例
文章地址:http://m.fisionsoft.com.cn/article/dhjcpdd.html


咨詢
建站咨詢
