mysql的函式問題

2021-08-29 20:07:47 字數 460 閱讀 2783

select namespace, name, version , description from api_registry where namespace = 'alibaba' and name = 'foo2' and version = 10

和select namespace, name, max(version) as version , description from api_registry where namespace = 'alibaba' and name = 'foo2' and version = 10

會得到不同的結果

第1條語句是查詢不到任何記錄,第2條語句是得到一條所有欄位都為null的記錄,

而第2條語句的情況如果在ibatis中會出現queryforobject查詢的結果不是null,而是乙個所有屬性都為null的物件,當物件中有原生型別的屬性,程式就會出錯,有空要看看其他資料庫是否有這樣的問題。

MYSQL設定自定義函式的問題

以root使用者進入資料庫set global log bin trust function creators 1 建立函式 fristpinyin 此函式是將乙個中文字串的第乙個漢字轉成拼音字母 例如 北京 b drop function if existsfristpinyin create f...

mysql 常用的函式 mysql常用的函式

1 if expr1,expr2,expr3 函式 如果 expr1 是true 則 if 的返回值為expr2 否則返回值則為 expr3。if 的返回值為數字值或字串值,具體情況視其所在語境而定。例 2 ifnull expr1,expr2 函式 如果expr1 不為 null,則 ifnull...

mysql 特殊函式 mysql 的特殊函式

1.format 函式 函式用於對字段的顯示進行格式化 語法 select format column name,format from table name column name 必需。要格式化的字段 format 必需。規定格式。2.ucase 函式 ucase 函式把字段的值轉換為大寫。語法...