📜  mariadb JSON_EXTRACT - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:03.550000             🧑  作者: Mango

代码示例1
+----+--------+-------+-------+---------------------------------+
| id | name   | price | stock | attr                            |
+----+--------+-------+-------+---------------------------------+
|  2 | Shirt  | 10.50 |    78 | {"size": 42, "colour": "white"} |
|  3 | Blouse | 17.00 |    15 | {"colour": "white"}             |
+----+--------+-------+-------+---------------------------------+
  
SELECT name FROM clothes WHERE JSON_EXTRACT(attr, '$.size') = 42;