自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL數(shù)據(jù)庫列值比較與邏輯函數(shù)IF簡介

數(shù)據(jù)庫 MySQL
如果你是MySQL數(shù)據(jù)庫方面的新手,對MySQL數(shù)據(jù)庫列值比較 ,以及邏輯函數(shù)IF的相關(guān)實際應(yīng)用不是很了解的話,以下的文章會給你提供更全面的知識。

MySQL數(shù)據(jù)庫列值比較 ,以及邏輯函數(shù)IF在實際中的應(yīng)用比例還是占為多數(shù)的,如果你對這MySQL數(shù)據(jù)庫列值比較 ,以及邏輯函數(shù)IFOracle 實際操作心存好奇的話,以下的文章將會揭開它的神秘面紗。

MySQL數(shù)據(jù)庫里abc 表

Sql代碼

  1. CREATE TABLE `abc` (   
  2. `uid` int(10) NOT NULL,   
  3. `num1` int(8) NOT NULL,   
  4. `num2` int(8) NOT NULL,   
  5. `num3` int(8) NOT NULL,   
  6. PRIMARY KEY (`uid`)   
  7. ENGINE=InnoDB DEFAULT CHARSET=gbk   
  8. CREATE TABLE `abc` (  
  9. `uid` int(10) NOT NULL,  
  10. `num1` int(8) NOT NULL,  
  11. `num2` int(8) NOT NULL,  
  12. `num3` int(8) NOT NULL,  
  13. PRIMARY KEY (`uid`)  
  14. ENGINE=InnoDB DEFAULT CHARSET=gbk   

 

任務(wù):是完成每列數(shù)據(jù)的比較,將uid 以及***數(shù)據(jù)列顯示出來。

方法:

Sql代碼

  1. select if((select if(num1>num2,num1,num2))>num3,(select if(num1>num2,num1,num2)),num3)as num,uid from abc;   
  2. select if((select if(num1>num2,num1,num2))>num3,(select if(num1>num2,num1,num2)),num3)as num,uid from abc;   

這樣寫感覺不好,有沒好的方法來比較。

 

結(jié)果如下:

Java代碼

  1. +-----+-----+   
  2. | num | uid |   
  3. +-----+-----+   
  4. | 3 | 1 |   
  5. | 3 | 2 |   
  6. | 4 | 3 |   
  7. | 5 | 4 |   
  8. | 8 | 5 |   
  9. | 13 | 6 |   
  10. | 56 | 7 |   
  11. +-----+-----+   
  12. 7 rows in set  


以上的相關(guān)內(nèi)容就是對MySQL數(shù)據(jù)庫列值比較 邏輯函數(shù)IF的介紹,望你能有所收獲。

【編輯推薦】

  1. MySQL高效分頁查詢的實際操作步驟
  2. MySQL5 master slave安裝配置全過程
  3. 如何通用存儲過程來對MySQL分頁查詢進行操作
  4. MySQL宣布Cluster數(shù)據(jù)庫的基準測試結(jié)果
  5. 影響MySQL數(shù)據(jù)庫安全的4個選項介紹
責(zé)任編輯:佚名 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-06-13 13:17:49

MySQL 列值

2010-06-13 10:18:08

MySQL 數(shù)據(jù)庫函數(shù)

2010-04-15 14:03:37

Oracle數(shù)據(jù)庫

2010-05-21 10:22:37

MySQL數(shù)據(jù)庫

2011-07-14 09:48:13

Oracle數(shù)據(jù)庫

2010-05-13 14:07:39

MySQL數(shù)據(jù)庫

2010-07-16 15:53:19

SQL Server數(shù)

2010-06-02 13:03:20

MySQL數(shù)據(jù)庫

2009-02-20 17:46:34

計算機英語數(shù)據(jù)庫管理系統(tǒng)簡介

2015-08-21 12:59:38

Oracle數(shù)據(jù)庫

2021-10-26 08:00:00

數(shù)據(jù)庫架構(gòu)技術(shù)

2011-08-15 09:48:30

MySQL數(shù)據(jù)庫完整備份增量備份

2010-05-12 09:42:24

MySQL 列值比較

2021-06-05 21:29:53

數(shù)據(jù)庫MySQL函數(shù)

2010-05-26 13:42:08

MySQL數(shù)據(jù)庫索引

2020-09-03 11:35:22

SQLiteMySQLPostgreSQL

2010-04-26 14:24:58

Oracle數(shù)據(jù)庫索引

2010-05-31 15:23:02

MySQL數(shù)據(jù)庫NUL

2011-03-30 13:44:45

MySQL數(shù)據(jù)庫鎖機制

2011-08-17 10:11:34

MySQL數(shù)據(jù)庫MVCC
點贊
收藏

51CTO技術(shù)棧公眾號