当前位置:网站首页>mysql8.0JSON_ Instructions for using contains
mysql8.0JSON_ Instructions for using contains
2022-07-05 14:25:00 【1024 questions】
JSON_CONTAINS Use
grammar
Case study
JSON_CONTAINS Function problem
The structure is as follows
JSON_CONTAINS Use grammarJSON_CONTAINS(json_doc, val[, path]) Case study select * from tb where info->'$.name' = ' Special promotion ' or JSON_CONTAINS(info->'$[*].name', '" Special promotion "', '$')SET @json = '{"A": 0, "B": {"C": 1}, "D": 2}';SELECT JSON_CONTAINS(@json, '2', '$.A');+----------------------------------+| JSON_CONTAINS(@json, '2', '$.A') |+----------------------------------+| 0 |+----------------------------------+SELECT JSON_CONTAINS(@json, '2', '$.D');+----------------------------------+| JSON_CONTAINS(@json, '2', '$.D') |+----------------------------------+| 1 |+----------------------------------+SELECT JSON_CONTAINS(@json, '{"C": 1}', '$.A');+-----------------------------------------+| JSON_CONTAINS(@json, '{"C": 1}', '$.A') |+-----------------------------------------+| 0 |+-----------------------------------------+SELECT JSON_CONTAINS(@json, '{"C": 1}', '$.B');+-----------------------------------------+| JSON_CONTAINS(@json, '{"C": 1}', '$.B') |+-----------------------------------------+| 1 |+-----------------------------------------+JSON_CONTAINS Function problem mysql Deposit is [14,15] This data structure Solution to query
The structure is as followsStudents :
@Column(value = "subject_ids", type = MySqlTypeConstant.TEXT)@ColumnComment(value = " subject . You can choose more , The format is as follows [1,2,3]")private List<Long> subjectIds;Database type :text
mysql Storage type : [14,15]
At this time, according to the subject ID Check which students have chosen 14 You can't use this subject when you have to in This grammar
It can be used at this time
SELECT * FROM `t_student` where JSON_CONTAINS(subject_ids, '14')The above is personal experience , I hope I can give you a reference , I also hope you can support the software development network .
边栏推荐
- 03_ Dataimport of Solr
- R语言ggplot2可视化密度图:按照分组可视化密度图、自定义配置geom_density函数中的alpha参数设置图像透明度(防止多条密度曲线互相遮挡)
- Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting
- R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
- LeetCode_ 69 (square root of x)
- R语言dplyr包select函数、group_by函数、mutate函数、cumsum函数计算dataframe分组数据中指定数值变量的累加值、并生成累加数据列
- 注意!软件供应链安全挑战持续升级
- Which Internet companies are worth going to in Shenzhen for software testers [Special Edition for software testers]
- Tdengine biweekly selection of community issues | phase III
- 2022年国内正规的期货公司平台有哪些啊?方正中期怎么样?安全可靠吗?
猜你喜欢

Thymeleaf th:classappend attribute append th:styleappend style append th:data- custom attribute

freesurfer运行完recon-all怎么快速查看有没有报错?——核心命令tail重定向

乌卡时代下,企业供应链管理体系的应对策略

区间 - 左闭右开

What are the advantages and characteristics of SAS interface

让秒杀狂欢更从容:大促背后的数据库(下篇)

PHP - fatal error: allowed memory size of 314572800 bytes exhausted

Qingda KeYue rushes to the science and Innovation Board: the annual revenue is 200million, and it is proposed to raise 750million

Tdengine biweekly selection of community issues | phase III

Thymeleaf 使用后台自定义工具类处理文本
随机推荐
mysql8.0JSON_CONTAINS的使用说明
世界环境日 | 周大福用心服务推动减碳环保
VC development of non MFC program memory leak tracking code
Don't be unconvinced. Mobile phone function upgrade is strong
TiCDC 6.0原理之Sorter演进
Tiflash compiler oriented automatic vectorization acceleration
04_ Use of solrj7.3 of solr7.3
freesurfer运行完recon-all怎么快速查看有没有报错?——核心命令tail重定向
Pointer operation - C language
ASP. Net large takeout ordering system source code (PC version + mobile version + merchant version)
Share 20 strange JS expressions and see how many correct answers you can get
家用电器行业商业供应链协同平台解决方案:供应链系统管理精益化,助推企业智造升级
分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少
动态规划
Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
Qingda KeYue rushes to the science and Innovation Board: the annual revenue is 200million, and it is proposed to raise 750million
mysql 自定义函数 身份证号转年龄(支持15/18位身份证)
汇编语言 assembly language
Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting
Show strength. In this way, the mobile phone will not be difficult to move forward