sql判断json是否为空
时间: 2023-11-13 15:04:44 浏览: 102
根据引用\[1\]和引用\[2\]的内容,要判断JSON是否为空,可以使用以下查询语句:select * from json_data where data->>'$.address.state' is not null; 这个查询语句会判断JSON中的address.state键值是否为空,并返回非空的数据。需要注意的是,JSON中的null并不等同于MySQL中的null,所以需要将键值转换为字符串再进行比较。引用\[3\]中提到,如果要查询键值为null或者不为null的数据,可以使用以下查询语句:select * from json_data where data->'$.address.state' is not null; 这个查询语句会返回键值为null或者不为null的数据。
#### 引用[.reference_title]
- *1* *2* *3* [mysql json类型数据查询(+判空、类型踩坑)](https://blog.csdn.net/qq_52503473/article/details/129877066)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![jar](https://img-home.csdnimg.cn/images/20210720083455.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)