MySQL JSON Path 鍵為數字的錯誤

2021-09-20 07:00:09 字數 783 閱讀 8054

小子在使用mysql的json時,鍵是數字,按常規方法訪問:

set@j=

', "other": }'

;select json_extract(@j,

'$.0.a')as

'$.0.a'

但是報了乙個異常:

檢視官方文件,有如下說明:

names of keys must be double-quoted strings or valid ecmascript identifiers (see path expressions, like json text, should be encoded using the ascii, utf8, or utf8mb4 character set. other character encodings are implicitly coerced to utf8mb4.

解決方法:

數字鍵必須單獨使用雙引號包圍,如下:

set@j=

', "other": }'

;select json_extract(@j,

'$."0".a')as

`$.0

.a`;

+-------+

| $.0.a |

+-------+

| 1 |

+-------+

1 row in set (0.00 sec)

mysql 外來鍵為空 MySQL外來鍵查詢返回空

我有三張桌子 我們來乙個demo organization field type null key default extra id int 11 no pri null auto increment org name varchar 100 no null org type varchar 100...

Android 修改軟體盤的回車鍵為搜尋鍵

xml中 主要是 android inputtype text android imeoptions actionsearch 中 軟鍵盤搜尋 etkeyword.setoneditoractionlistener new textview.oneditoractionlistener return...

linux下如何更改capslock鍵為ESC

size 11 部落格 url 網路上面很多的方法,不過基本我都試過,不靠譜的太多,特別是很多部落格,可能自己也不試試就隨便貼出來。所以有時候建議大家還是用英文搜尋,這樣也許答案很快就能出來。其他系統的修改方案 mac url windows url size 第一步 在你的home目錄下建立檔案 ...