Select MySQL 中特定列中 json 中键的值
Select value for a key in json in specific column in MySQL
在 MySQL 中,我如何 select 只为所有行的 jsonInfo 列中的国籍键值?
userid displayName jsonInfo
11 John Nakamura {"nationality":"ROK", "build": "average", "height":"511", "eyeColor":"brown", "ethnicity":"Asian"}
12 Jose Hernandez {"nationality": "El Salvador", "build": "average", "height":"510", "eyeColor":"brown", "ethnicity":"Latino"}
13 Bobby Simmons {"nationality": "USA", "build": "big", "height":"601", "eyeColor":"blue", "ethnicity":"Caucasian"}
SELECT jsonInfo->>'$.nationnality' FROM tbl
在 MySQL 中,我如何 select 只为所有行的 jsonInfo 列中的国籍键值?
userid displayName jsonInfo
11 John Nakamura {"nationality":"ROK", "build": "average", "height":"511", "eyeColor":"brown", "ethnicity":"Asian"}
12 Jose Hernandez {"nationality": "El Salvador", "build": "average", "height":"510", "eyeColor":"brown", "ethnicity":"Latino"}
13 Bobby Simmons {"nationality": "USA", "build": "big", "height":"601", "eyeColor":"blue", "ethnicity":"Caucasian"}
SELECT jsonInfo->>'$.nationnality' FROM tbl