{"id":96690,"date":"2024-04-11T15:11:15","date_gmt":"2024-04-11T07:11:15","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/96690.html"},"modified":"2024-04-11T15:11:17","modified_gmt":"2024-04-11T07:11:17","slug":"%e6%80%8e%e6%a0%b7%e5%9c%a8-mysql-%e8%a1%a8%e4%b8%ad%e5%ad%98%e5%82%a8%e6%a0%91%e5%bd%a2%e7%bb%93%e6%9e%84%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/96690.html","title":{"rendered":"\u600e\u6837\u5728 MySQL \u8868\u4e2d\u5b58\u50a8\u6811\u5f62\u7ed3\u6784\u6570\u636e"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/02172716\/456317fe-c5e8-43ff-b2e7-8cb8aacce456.webp\" alt=\"\u600e\u6837\u5728 MySQL \u8868\u4e2d\u5b58\u50a8\u6811\u5f62\u7ed3\u6784\u6570\u636e\" \/><\/p>\n<p><p>\u6811\u5f62\u7ed3\u6784\u6570\u636e\u5728MySQL\u8868\u4e2d\u901a\u5e38\u91c7\u7528\u51e0\u79cd\u4e3b\u8981\u7684\u65b9\u6cd5\u5b58\u50a8\uff1a<strong>\u90bb\u63a5\u5217\u8868\u6a21\u578b\u3001\u8def\u5f84\u679a\u4e3e\u6a21\u578b\u3001\u5d4c\u5957\u96c6\u6a21\u578b\u3001\u95ed\u5305\u8868\u6a21\u578b<\/strong>\u3002\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c<strong>\u90bb\u63a5\u5217\u8868\u6a21\u578b<\/strong>\u7ecf\u5e38\u7528\u4e8e\u8868\u793a\u6811\u5f62\u7ed3\u6784\uff0c\u8be5\u6a21\u578b\u901a\u8fc7\u5728\u6bcf\u6761\u8bb0\u5f55\u4e2d\u5305\u542b\u6307\u5411\u7236\u8bb0\u5f55\u7684\u5916\u952e\u6765\u6784\u9020\u6570\u636e\u7684\u5c42\u7ea7\u5173\u7cfb\u3002<\/p>\n<\/p>\n<p><p>\u5177\u4f53\u6765\u8bf4\uff0c\u90bb\u63a5\u5217\u8868\u6a21\u578b\u4e2d\u6bcf\u4e2a\u8282\u70b9\u5b58\u50a8\u4e86\u5b83\u7684\u7236\u8282\u70b9ID\uff0c\u8fd9\u79cd\u65b9\u6cd5\u7684\u4f18\u70b9\u662f\u7ed3\u6784\u7b80\u5355\uff0c\u76f4\u89c2\uff0c\u6613\u4e8e\u5b9e\u73b0\uff1b\u800c\u7f3a\u70b9\u662f\u67e5\u8be2\u6574\u4e2a\u6811\u6216\u8005\u5b50\u6811\u65f6\u9700\u8981\u9012\u5f52\u67e5\u8be2\uff0c\u6027\u80fd\u76f8\u5bf9\u8f83\u4f4e\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u90e8\u95e8\u7ed3\u6784\u8868\u53ef\u80fd\u901a\u8fc7\u6bcf\u4e2a\u90e8\u95e8\u8bb0\u5f55\u4e2d\u7684\u201cparent_department_id\u201d\u5b57\u6bb5\u6765\u5f15\u7528\u4e0a\u7ea7\u90e8\u95e8\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u90bb\u63a5\u5217\u8868\u6a21\u578b<\/h3>\n<\/p>\n<p><p>\u90bb\u63a5\u5217\u8868\u6a21\u578b\u662f\u6700\u76f4\u89c2\u7684\u5b58\u50a8\u65b9\u5f0f\uff0c\u5b83\u901a\u5e38\u5305\u62ec\u6bcf\u4e2a\u8282\u70b9\u7684id\u4ee5\u53ca\u7236\u8282\u70b9\u7684id\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u7ed3\u6784\u8bf4\u660e<\/strong><\/p>\n<p>\u5728\u4f7f\u7528\u90bb\u63a5\u5217\u8868\u6a21\u578b\u65f6\uff0c\u6bcf\u6761\u8bb0\u5f55\u5305\u542b\u4e00\u4e2a\u6307\u5411\u5176\u4ed6\u8bb0\u5f55\uff08\u4e00\u822c\u662f\u5176\u7236\u8bb0\u5f55\uff09\u7684\u5916\u952e\u3002\u4f8b\u5982\uff0c\u5728\u90e8\u95e8\u8868\u4e2d\uff0c\u6bcf\u4e2a\u90e8\u95e8\u8bb0\u5f55\u90fd\u6709\u4e00\u4e2a<code>parent_id<\/code>\u5b57\u6bb5\u6307\u5411\u4e0a\u7ea7\u90e8\u95e8\u7684<code>id<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b9e\u73b0\u6811\u5f62\u67e5\u8be2<\/strong><\/p>\n<p>\u867d\u7136\u7b80\u5355\uff0c\u8fd9\u79cd\u6a21\u578b\u5728\u67e5\u8be2\u65f6\u53ef\u80fd\u9762\u4e34\u6548\u7387\u95ee\u9898\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u9012\u5f52\u5730\u67e5\u8be2\u6bcf\u4e2a\u8282\u70b9\u7684\u5b50\u8282\u70b9\u3002\u7ed3\u679c\u662f\u5bf9\u591a\u5c42\u7ea7\u7684\u6811\u67e5\u8be2\u65f6\uff0c\u53ef\u80fd\u8981\u6267\u884c\u591a\u4e2a\u5d4c\u5957\u67e5\u8be2\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e8c\u3001\u8def\u5f84\u679a\u4e3e\u6a21\u578b<\/h3>\n<\/p>\n<p><p>\u8def\u5f84\u679a\u4e3e\u6a21\u578b\u901a\u8fc7\u5728\u6bcf\u4e2a\u8282\u70b9\u8bb0\u5f55\u5b83\u7684\u5b8c\u6574\u8def\u5f84\u6765\u907f\u514d\u9012\u5f52\u67e5\u8be2\uff0c\u6210\u4e3a\u4e86\u5904\u7406\u8bfb\u64cd\u4f5c\u66f4\u9ad8\u6548\u7684\u4e00\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u7ed3\u6784\u8bf4\u660e<\/strong><\/p>\n<p>\u5728\u6b64\u6a21\u578b\u4e2d\uff0c\u6bcf\u4e2a\u8282\u70b9\u90fd\u6709\u4e00\u4e2a<code>path<\/code>\u5b57\u6bb5\uff0c\u8be5\u5b57\u6bb5\u5305\u542b\u4ece\u6839\u8282\u70b9\u5230\u5f53\u524d\u8282\u70b9\u7684\u5b8c\u6574\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u8282\u70b9\u7684\u8def\u5f84\u53ef\u80fd\u662f<code>\/1\/5\/12<\/code>\uff0c\u8868\u660e\u5b83\u662f\u6839\u8282\u70b9<code>1<\/code>\u4e0b\u7b2c<code>5<\/code>\u4e2a\u5b50\u8282\u70b9\u7684\u7b2c<code>12<\/code>\u4e2a\u5b50\u8282\u70b9\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u8be2\u4f18\u52bf<\/strong><\/p>\n<p>\u8def\u5f84\u679a\u4e3e\u6a21\u578b\u5728\u67e5\u8be2\u6574\u68f5\u6811\u6216\u7279\u5b9a\u7684\u5b50\u6811\u65f6\u5341\u5206\u9ad8\u6548\uff0c\u65e0\u9700\u9012\u5f52\u67e5\u8be2\uff0c\u53ea\u9700\u8981\u5bf9\u8def\u5f84\u5b57\u6bb5\u8fdb\u884c\u5339\u914d\u5373\u53ef\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e09\u3001\u5d4c\u5957\u96c6\u6a21\u578b<\/h3>\n<\/p>\n<p><p>\u5d4c\u5957\u96c6\u6a21\u578b\u4f7f\u7528\u4e24\u4e2a\u6570\u503c\u6765\u5b9a\u4e49\u8282\u70b9\u7684\u8fb9\u754c\uff0c\u5e76\u4e14\u901a\u8fc7\u8fd9\u4e9b\u8fb9\u754c\u6765\u5feb\u901f\u67e5\u8be2\u7236\u8282\u70b9\u3001\u5b50\u8282\u70b9\u53ca\u540c\u7ea7\u8282\u70b9\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u6982\u5ff5\u7406\u89e3<\/strong><\/p>\n<p>\u6bcf\u4e2a\u8282\u70b9\u6709\u4e24\u4e2a\u503c\uff1a<code>left<\/code>\u548c<code>right<\/code>\uff0c\u5176\u4e2d<code>left<\/code>\u503c\u5c0f\u4e8e\u5b83\u7684\u4efb\u4f55\u540e\u4ee3\u8282\u70b9\u7684\u503c\uff0c\u800c<code>right<\/code>\u503c\u5927\u4e8e\u4efb\u4f55\u540e\u4ee3\u8282\u70b9\u7684\u503c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u8be2\u548c\u4fee\u6539<\/strong><\/p>\n<p>\u67e5\u8be2\u662f\u5d4c\u5957\u96c6\u6a21\u578b\u7684\u4e00\u4e2a\u5f3a\u9879\uff0c\u53ef\u4ee5\u975e\u5e38\u5feb\u901f\u5730\u67e5\u627e\u8282\u70b9\u548c\u5b83\u4eec\u7684\u5173\u7cfb\u3002\u4e0d\u8fc7\uff0c\u63d2\u5165\u548c\u79fb\u52a8\u8282\u70b9\u53ef\u80fd\u5f88\u590d\u6742\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u6d89\u53ca\u5927\u91cf\u7684\u8282\u70b9\u66f4\u65b0\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u56db\u3001\u95ed\u5305\u8868\u6a21\u578b<\/h3>\n<\/p>\n<p><p>\u95ed\u5305\u8868\u6a21\u578b\u4f7f\u7528\u4e00\u4e2a\u989d\u5916\u7684\u8868\u6765\u5b58\u50a8\u8282\u70b9\u4e4b\u95f4\u7684\u5173\u7cfb\uff0c\u7ed9\u51fa\u4e00\u4e2a\u8282\u70b9\u4e4b\u95f4\u5173\u7cfb\u7684\u5168\u89c6\u56fe\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u9644\u52a0\u8868\u7ed3\u6784<\/strong><\/p>\n<p>\u5728\u95ed\u5305\u8868\u6a21\u578b\u4e2d\uff0c\u4f1a\u6709\u4e00\u4e2a\u989d\u5916\u7684\u8868\u6765\u5b58\u50a8\u8282\u70b9\u95f4\u7684\u5173\u7cfb\uff0c\u901a\u5e38\u8fd9\u4e2a\u8868\u5305\u542b<code>ancestor<\/code>\uff08\u7956\u5148\uff09\u3001<code>descendant<\/code>\uff08\u540e\u4ee3\uff09\u548c<code>depth<\/code>\uff08\u6df1\u5ea6\uff09\u5b57\u6bb5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7075\u6d3b\u6027<\/strong><\/p>\n<p>\u8be5\u6a21\u578b\u6781\u5176\u7075\u6d3b\uff0c\u80fd\u591f\u975e\u5e38\u5feb\u901f\u5730\u67e5\u8be2\u4efb\u610f\u8282\u70b9\u7684\u5b50\u6811\u6216\u8005\u8def\u5f84\uff0c\u4f46\u662f\u5728\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u65f6\u4e5f\u9700\u8981\u540c\u6b65\u66f4\u65b0\u5173\u7cfb\u8868\uff0c\u8fd9\u53ef\u80fd\u662f\u4e00\u4e2a\u5f00\u9500\u8f83\u5927\u7684\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4ee5\u4e0a\u4ecb\u7ecd\u7684\u56db\u79cd\u65b9\u6cd5\u90fd\u6709\u5b83\u4eec\u5404\u81ea\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\uff0c\u9009\u62e9\u54ea\u4e00\u79cd\u6a21\u578b\u5b58\u50a8\u6811\u5f62\u7ed3\u6784\u6570\u636e\uff0c\u4e3b\u8981\u53d6\u51b3\u4e8e\u5e94\u7528\u573a\u666f\u4e2d\u5bf9\u8bfb\u548c\u5199\u64cd\u4f5c\u7684\u8981\u6c42\u3002\u5728\u5b9e\u8df5\u4e2d\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u8981\u51b3\u5b9a\u4f7f\u7528\u54ea\u79cd\u65b9\u5f0f\uff0c\u5e76\u53ef\u80fd\u6839\u636e\u6570\u636e\u5e93\u6027\u80fd\u4f18\u5316\u9700\u6c42\u52a8\u6001\u8c03\u6574\u6570\u636e\u6a21\u578b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728 MySQL \u8868\u4e2d\u5b58\u50a8\u6811\u5f62\u7ed3\u6784\u6570\u636e?<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"\u6811\u5f62\u7ed3\u6784\u6570\u636e\u5728MySQL\u8868\u4e2d\u901a\u5e38\u91c7\u7528\u51e0\u79cd\u4e3b\u8981\u7684\u65b9\u6cd5\u5b58\u50a8\uff1a\u90bb\u63a5\u5217\u8868\u6a21\u578b\u3001\u8def\u5f84\u679a\u4e3e\u6a21\u578b\u3001\u5d4c\u5957\u96c6\u6a21\u578b\u3001\u95ed\u5305\u8868\u6a21\u578b\u3002\u5728 [&hellip;]","protected":false},"author":3,"featured_media":96694,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/96690"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=96690"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/96690\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/96694"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=96690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=96690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=96690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}