{"id":6383,"date":"2024-11-14T12:02:36","date_gmt":"2024-11-14T04:02:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6383\/"},"modified":"2024-11-14T12:02:36","modified_gmt":"2024-11-14T04:02:36","slug":"mysql%e5%93%aa%e4%b8%aa%e7%89%88%e6%9c%ac%e6%94%af%e6%8c%81json","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6383\/","title":{"rendered":"mysql\u54ea\u4e2a\u7248\u672c\u652f\u6301json"},"content":{"rendered":"<blockquote><p>\n  mysql 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u652f\u6301 json \u6570\u636e\uff0c\u5305\u62ec\u521b\u5efa\u3001\u5b58\u50a8\u3001\u67e5\u8be2\u3001\u4fee\u6539\u548c\u5d4c\u5957 json \u6570\u636e\uff0c\u5e76\u63d0\u4f9b json \u51fd\u6570\u548c\u64cd\u4f5c\u7b26\u652f\u6301\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/01\/2024080106223587259.jpg\" class=\"aligncenter\" title=\"mysql\u54ea\u4e2a\u7248\u672c\u652f\u6301json\u63d2\u56fe\" alt=\"mysql\u54ea\u4e2a\u7248\u672c\u652f\u6301json\u63d2\u56fe\" \/><\/p>\n<p><strong>\u54ea\u4e2a MySQL \u7248\u672c\u652f\u6301 JSON\uff1f<\/strong><\/p>\n<p>MySQL 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u652f\u6301 JSON\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u89e3\u91ca\uff1a<\/strong><\/p>\n<p>JSON (JavaScript Object Notation)\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u6570\u636e\u4ea4\u6362\u683c\u5f0f\uff0c\u7528\u4e8e\u5728\u4e0d\u540c\u7684\u7cfb\u7edf\u548c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u8f93\u6570\u636e\u3002MySQL 5.7 \u5f15\u5165\u4e86\u5bf9 JSON \u7684\u539f\u751f\u652f\u6301\uff0c\u5141\u8bb8\u7528\u6237\u521b\u5efa\u3001\u5b58\u50a8\u3001\u67e5\u8be2\u548c\u4fee\u6539 JSON \u6570\u636e\u3002<\/p>\n<p><strong>MySQL \u652f\u6301\u7684 JSON \u529f\u80fd\u5305\u62ec\uff1a<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u548c\u5b58\u50a8 JSON \u6570\u636e\u7c7b\u578b<\/li>\n<li>\u67e5\u8be2\u548c\u8fc7\u6ee4 JSON \u6570\u636e<\/li>\n<li>\u66f4\u65b0\u548c\u5220\u9664 JSON \u6570\u636e<\/li>\n<li>\u5d4c\u5957\u548c\u6570\u7ec4 JSON \u6570\u636e<\/li>\n<li>JSON \u51fd\u6570\u548c\u64cd\u4f5c\u7b26<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u652f\u6301 JSON\uff0cMySQL \u80fd\u591f\u66f4\u597d\u5730\u5904\u7406\u548c\u7ba1\u7406\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5e38\u89c1\u7684\u975e\u7ed3\u6784\u5316\u548c\u534a\u7ed3\u6784\u5316\u6570\u636e\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528 MySQL 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u521b\u5efa\u548c\u67e5\u8be2 JSON \u6570\u636e\uff1a<\/p>\n<pre>CREATE TABLE users (\n  id INT NOT NULL AUTO_INCREMENT,\n  name VARCHAR(255) NOT NULL,\n  data JSON NOT NULL,\n  PRIMARY KEY (id)\n);\n\nINSERT INTO users (name, data) VALUES\n  ('John Doe', '{\"age\": 30, \"occupation\": \"Software Engineer\"}'),\n  ('Jane Smith', '{\"age\": 25, \"occupation\": \"Data Scientist\"}');\n\nSELECT * FROM users WHERE data-&gt;'$.occupation' = 'Software Engineer';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u54ea\u4e2a\u7248\u672c\u652f\u6301json\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u652f\u6301 json \u6570\u636e\uff0c\u5305\u62ec\u521b\u5efa\u3001\u5b58\u50a8\u3001\u67e5\u8be2\u3001\u4fee\u6539\u548c\u5d4c\u5957 json \u6570\u636e\uff0c\u5e76\u63d0\u4f9b json \u51fd\u6570\u548c\u64cd\u4f5c\u7b26\u652f\u6301\u3002 \u54ea\u4e2a MySQL \u7248\u672c\u652f\u6301 JSON\uff1f MySQL 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u652f\u6301 JSON\u3002 \u8be6\u7ec6\u89e3\u91ca\uff1a JSON (JavaScript Object Notation)\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u6570\u636e\u4ea4\u6362\u683c\u5f0f\uff0c\u7528\u4e8e\u5728\u4e0d\u540c\u7684\u7cfb\u7edf\u548c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u8f93\u6570\u636e\u3002MySQL 5.7 \u5f15\u5165\u4e86\u5bf9 JSON \u7684\u539f\u751f\u652f\u6301\uff0c\u5141\u8bb8\u7528\u6237\u521b\u5efa\u3001\u5b58\u50a8\u3001\u67e5\u8be2\u548c\u4fee\u6539 JSON \u6570\u636e\u3002 MySQL \u652f\u6301\u7684 JSON \u529f\u80fd\u5305\u62ec\uff1a \u521b\u5efa\u548c\u5b58\u50a8 JSON \u6570\u636e\u7c7b\u578b \u67e5\u8be2\u548c\u8fc7\u6ee4 JSON \u6570\u636e \u66f4\u65b0\u548c\u5220\u9664 JSON \u6570\u636e \u5d4c\u5957\u548c\u6570\u7ec4 JSON \u6570\u636e JSON \u51fd\u6570\u548c\u64cd\u4f5c\u7b26 \u901a\u8fc7\u652f\u6301 JSON\uff0cMySQL \u80fd\u591f\u66f4\u597d\u5730\u5904\u7406\u548c\u7ba1\u7406\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5e38\u89c1\u7684\u975e\u7ed3\u6784\u5316\u548c\u534a\u7ed3\u6784\u5316\u6570\u636e\u3002 \u793a\u4f8b\uff1a \u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528 MySQL 5.7 \u53ca\u66f4\u9ad8\u7248\u672c\u521b\u5efa\u548c\u67e5\u8be2 JSON [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6383","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6383"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6383\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}