{"id":2276,"date":"2026-05-26T08:05:43","date_gmt":"2026-05-26T08:05:43","guid":{"rendered":"https:\/\/www.vpascode.com\/tw\/docs\/uncategorized\/mermaid-js-erd-syntax-guide\/"},"modified":"2026-05-26T08:05:43","modified_gmt":"2026-05-26T08:05:43","slug":"mermaid-js-erd-syntax-guide","status":"publish","type":"ld_docs","link":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/","title":{"rendered":"Mermaid.js ERD \u8a9e\u6cd5\u6307\u5357"},"content":{"rendered":"<h2>\u4ec0\u9ebc\u662f\u5be6\u9ad4\u95dc\u4fc2\u5716\uff08ERD\uff09\uff1f<\/h2>\n<p>\u4e00\u500b<strong>\u5be6\u9ad4\u95dc\u4fc2\u5716\uff08ERD\uff09<\/strong>\u662f\u4e00\u7a2e\u7d50\u69cb\u85cd\u5716\uff0c\u7528\u65bc\u8a2d\u8a08\u3001\u8a18\u9304\u548c\u5206\u6790\u95dc\u4fc2\u578b\u8cc7\u6599\u5eab\u7d50\u69cb\u3002\u5b83\u6982\u8ff0\u4e86\u61c9\u7528\u7a0b\u5f0f\u5167\u7684\u7279\u5b9a\u8cc7\u6599\u8868\uff08\u5be6\u9ad4\uff09\uff0c\u8868\u5167\u5d4c\u5957\u7684\u6b04\u4f4d\uff08\u5c6c\u6027\uff09\uff0c\u4ee5\u53ca\u5c07\u5b83\u5011\u9023\u7d50\u5728\u4e00\u8d77\u7684\u53c3\u8003\u5b8c\u6574\u6027\u898f\u5247\u3002\u4f7f\u7528\u6a19\u6e96<strong>\u8cc7\u8a0a\u5de5\u7a0b\uff08IE\uff09\u7b26\u865f<\/strong>\uff0c\u5b83\u4f7f\u7528\u6e05\u6670\u7684<strong>\u70cf\u9d09\u8173\u7b26\u865f<\/strong>\u982d\u90e8\u4f86\u986f\u793a\u8cc7\u6599\u7d04\u675f\u548c\u591a\u8868\u4f9d\u8cf4\u95dc\u4fc2\u3002<\/p>\n<p>\u4f7f\u7528<strong>Mermaid.js<\/strong>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e7e\u6de8\u3001\u5ba3\u544a\u5f0f\u7684\u6587\u5b57\u5340\u584a\u4f86\u5b9a\u7fa9\u751f\u7522\u74b0\u5883\u8cc7\u6599\u8868\u7684\u7d22\u5f15\u3001\u8cc7\u6599\u985e\u578b\u548c\u5916\u4f86\u9375\u9023\u63a5\u3002\u5f15\u64ce\u6703\u81ea\u52d5\u8655\u7406\u591a\u6b04\u4f4d\u7248\u9762\u5bb9\u5668\u7684\u5927\u5c0f\u8abf\u6574\uff0c\u4e26\u8def\u7531\u9023\u63a5\u7dda\uff0c\u907f\u514d\u6587\u5b57\u6a19\u7c64\u91cd\u758a\u3002<\/p>\n<h2>\u6838\u5fc3\u8a9e\u6cd5\u6307\u5357\uff1a\u5143\u7d20\u8207\u69cb\u9020<\/h2>\n<p>\u5728 Mermaid \u4e2d\u5efa\u7acb\u6709\u6548\u4e14\u53ef\u57f7\u884c\u7684\u8cc7\u6599\u5eab\u7d50\u69cb\uff0c\u53d6\u6c7a\u65bc\u7d50\u69cb\u5316\u5be6\u9ad4\u5340\u584a\u3001\u8cc7\u6599\u985e\u578b\u5c0d\u61c9\u3001\u7d22\u5f15\u6a19\u7c64\u548c\u57fa\u6578\u904b\u7b97\u5b50\u3002<\/p>\n<h3>1. \u8072\u660e\u5be6\u9ad4\u8207\u8cc7\u6599\u8868\u6b04\u4f4d<\/h3>\n<p>\u60a8\u53ef\u4ee5\u5728\u7b2c\u4e00\u884c\u4f7f\u7528<code>erDiagram<\/code>\u95dc\u9375\u5b57\u4f86\u521d\u59cb\u5316 ERD \u756b\u5e03\u3002\u8981\u5b9a\u7fa9\u8cc7\u6599\u8868\uff0c\u8acb\u5728\u5be6\u9ad4\u540d\u7a31\u5f8c\u9762\u52a0\u4e0a\u958b\u62ec\u865f\uff0c\u4e26\u5728\u55ae\u7368\u7684\u884c\u4e0a\u4f9d\u5e8f\u5217\u51fa\u60a8\u7684\u6b04\u4f4d\u8a2d\u5b9a\uff1a<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Mermaid<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghWoIBwQy80oUMlMQ\/OKSosy8dIXU3MTMHIRoSWZuanFJYm6BQnJRamJJakp8YglEthYAu7UZoQ==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Mermaid<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghWoIBwQy80oUMlMQ\/OKSosy8dIXU3MTMHIRoSWZuanFJYm6BQnJRamJJakp8YglEthYAu7UZoQ==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-mermaid\"><code class=\"language-mermaid\" data-language=\"mermaid\" class=\"language-mermaid\">erDiagram\r\n    USERS {\r\n        int id\r\n        string email\r\n        timestamp created_at\r\n    }<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghWoIBwQy80oUMlMQ\/OKSosy8dIXU3MTMHIRoSWZuanFJYm6BQnJRamJJakp8YglEthYAu7UZoQ==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghWoIBwQy80oUMlMQ\/OKSosy8dIXU3MTMHIRoSWZuanFJYm6BQnJRamJJakp8YglEthYAu7UZoQ==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"VkXootV\"><img alt=\"\" class=\"alignnone size-full wp-image-629\" decoding=\"async\" height=\"187\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903a383fb3.png\" width=\"221\"\/><\/p>\n<h3>2. \u6a19\u8a18\u4e3b\u9375\u3001\u5916\u4f86\u9375\u548c\u8a3b\u89e3<\/h3>\n<p>Mermaid \u7684 ERD \u5f15\u64ce\u5141\u8a31\u60a8\u5728\u6b04\u4f4d\u540d\u7a31\u548c\u8cc7\u6599\u985e\u578b\u5b9a\u7fa9\u5f8c\u76f4\u63a5\u6307\u5b9a\u7d50\u69cb\u5316\u7d22\u5f15\u6a19\u7c64\u3002\u60a8\u4e5f\u53ef\u4ee5\u900f\u904e\u96d9\u5f15\u865f\u5305\u8986\u4f86\u70ba\u6b04\u4f4d\u9644\u52a0\u53ef\u9078\u7684\u6587\u5b57\u8a3b\u89e3\uff1a<\/p>\n<ul>\n<li><code>PK<\/code> \u2014 \u660e\u78ba\u6a19\u793a\u6b04\u4f4d\u70ba\u8cc7\u6599\u8868\u7684\u4e3b\u9375\u3002<\/li>\n<li><code>FK<\/code> \u2014 \u6a19\u793a\u6b04\u4f4d\u70ba\u9023\u7d50\u81f3\u7236\u8cc7\u6599\u8868\u7684\u5916\u4f86\u9375\u3002<\/li>\n<\/ul>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Mermaid<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAv8gF9egYIVqCA8EMvNKFDJTFAK8UYVKi1OL4oHibt4KSj6ZednFCiX5CqHBQM16mSlKCLXFJUWZeekKyfmlBfl58cn5KakQuVoAct0gOw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Mermaid<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAv8gF9egYIVqCA8EMvNKFDJTFAK8UYVKi1OL4oHibt4KSi8bFj\/fOuFF+2aF0GCgbr3MFCWE4uKSosy8dIXk\/NKC\/Lz45PyUVIhcLQAs5yOR\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-mermaid\"><code class=\"language-mermaid\" data-language=\"mermaid\" class=\"language-mermaid\">erDiagram\r\n    ORDERS {\r\n        int id PK\r\n        int user_id FK \"\u9023\u7d50\u81f3 USERS.id\"\r\n        string coupon_code\r\n    }<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAv8gF9egYIVqCA8EMvNKFDJTFAK8UYVKi1OL4oHibt4KSi8bFj\/fOuFF+2aF0GCgbr3MFCWE4uKSosy8dIXk\/NKC\/Lz45PyUVIhcLQAs5yOR\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAv8gF9egYIVqCA8EMvNKFDJTFAK8UYVKi1OL4oHibt4KSj6ZednFCiX5CqHBQM16mSlKCLXFJUWZeekKyfmlBfl58cn5KakQuVoAct0gOw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"aCCwRBw\"><img fetchpriority=\"high\" alt=\"\" class=\"alignnone size-full wp-image-632\" decoding=\"async\" fetchpriority=\"high\" height=\"817\" sizes=\"(max-width: 268px) 100vw, 268px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451.png 268w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451-98x300.png 98w\" width=\"268\"\/><\/p>\n<h3>3. \u638c\u63e1\u70cf\u9d09\u8db3\u57fa\u6578\u4fee\u98fe\u7b26<\/h3>\n<p>\u70ba\u4e86\u9023\u63a5\u8868\u683c\u4e26\u5f37\u5236\u57f7\u884c\u53c3\u8003\u5b8c\u6574\u6027\u898f\u5247\uff0c\u8acb\u4f7f\u7528\u5c08\u7528\u7684\u7dda\u6bb5\u904b\u7b97\u7b26\u4f86\u6a19\u793a\u5b83\u5011\u7684\u95dc\u4fc2\u3002\u5b57\u5143\u982d\u90e8\u5f62\u6210\u8996\u89ba\u4e0a\u7684\u70cf\u9d09\u8db3\u5f62\u72c0\uff0c\u7528\u4ee5\u898f\u5b9a\u8cc7\u6599\u591a\u6a23\u6027\u7d04\u675f\uff1a<\/p>\n<ul>\n<li><code>||--||<\/code> **\u7cbe\u78ba\u4e00\u5c0d\u4e00\uff1a** \u56b4\u683c\u7684\u3001\u5f37\u5236\u6027\u7684 1:1 \u6620\u5c04\u3002<\/li>\n<li><code>||--o|<\/code> **\u7cbe\u78ba\u4e00\u5c0d\u96f6\u6216\u4e00\uff1a** \u53ef\u9078\u7684 1:1 \u4f9d\u8cf4\u95dc\u4fc2\u3002<\/li>\n<li><code>||--|{<\/code> **\u7cbe\u78ba\u4e00\u5c0d\u4e00\u6216\u591a\uff1a** \u5f37\u5236\u6027\u7684 1:N \u7236\u7d1a\u9023\u7d50\u3002<\/li>\n<li><code>||--o{<\/code> **\u7cbe\u78ba\u4e00\u5c0d\u96f6\u3001\u4e00\u6216\u591a\uff1a** \u6a19\u6e96\u7684\u3001\u53ef\u9078\u7684 1:N \u95dc\u4fc2\u3002<\/li>\n<\/ul>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Mermaid<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghZoaXd38agX\/IBcQz0pBqSAnMTm1WAkAMZMNNw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Mermaid<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghZoaXd38agX\/IBcQz0pB6dmUfc\/3rlMCADscD0k=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-mermaid\"><code class=\"language-mermaid\" data-language=\"mermaid\" class=\"language-mermaid\">erDiagram\r\n    USERS ||--o{ ORDERS : \"\u653e\u7f6e\" <\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghZoaXd38agX\/IBcQz0pB6dmUfc\/3rlMCADscD0k=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAgtBg16BghZoaXd38agX\/IBcQz0pBqSAnMTm1WAkAMZMNNw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p><img alt=\"\" class=\"alignnone size-full wp-image-631\" decoding=\"async\" height=\"285\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903aca991c.png\" width=\"116\"\/><\/p>\n<h2>\u95dc\u4fc2\u578b\u8cc7\u6599\u7d50\u69cb\u7684\u6700\u4f73\u5be6\u52d9<\/h2>\n<ul>\n<li><strong>\u7dad\u6301\u4e00\u81f4\u7684\u8868\u683c\u5927\u5c0f\u5beb\uff1a<\/strong> \u4fdd\u6301\u5be6\u9ad4\u540d\u7a31\u53ef\u9810\u6e2c\u3002\u4f7f\u7528\u5927\u5beb\u5b57\u4e32\uff08\u4f8b\u5982\uff0c<code>USER_ACCOUNTS<\/code>\uff09\u6216\u56b4\u683c\u7684\u5c0f\u5beb\u86c7\u5f62\u547d\u540d\u6cd5\uff08\u4f8b\u5982\uff0c<code>user_accounts<\/code>\uff09\u4ee5\u7b26\u5408\u60a8\u5be6\u969b\u7684 SQL \u57fa\u790e\u8a2d\u65bd\u7a0b\u5f0f\u78bc\u3002<\/li>\n<li><strong>\u59cb\u7d42\u5305\u542b\u8cc7\u6599\u985e\u578b\uff1a<\/strong> \u907f\u514d\u5728\u672a\u6307\u5b9a\u985e\u578b\u7684\u60c5\u6cc1\u4e0b\u76f4\u63a5\u5ba3\u544a\u6b04\u4f4d\u6587\u5b57\u3002\u660e\u78ba\u5217\u51fa\u5982 <code>int<\/code>, <code>varchar<\/code>\uff0c\u6216 <code>boolean<\/code> \u78ba\u4fdd\u60a8\u7684\u67b6\u69cb\u5716\u8868\u80fd\u4f5c\u70ba\u6e96\u78ba\u7684\u6280\u8853\u53c3\u8003\u3002<\/li>\n<li><strong>\u4fdd\u6301\u95dc\u4fc2\u6a19\u7c64\u70ba\u52d5\u8a5e\uff1a<\/strong> \u5728\u9023\u7d50\u5143\u7d20\u6642\uff0c\u8acb\u5728\u95dc\u4fc2\u6307\u6d3e\u4e2d\u63d0\u4f9b\u4e00\u500b\u7c21\u77ed\u7684\u3001\u5c0f\u5beb\u7684\u4e3b\u52d5\u8a5e\u5b57\u4e32\uff08\u4f8b\u5982\uff0c<code>||--o{ : \"\u5305\u542b\"<\/code>) \u4ee5\u8a18\u9304\u696d\u52d9\u908f\u8f2f\u7684\u5c0d\u61c9\u95dc\u4fc2\u3002<\/li>\n<\/ul>\n<h2>\u73fe\u5be6\u4e16\u754c\u4e2d\u7684 Mermaid.js ERD \u7bc4\u4f8b<\/h2>\n<h3>\u7bc4\u4f8b 1\uff1a\u6838\u5fc3\u96fb\u5b50\u5546\u52d9\u4ea4\u6613\u6a21\u578b\uff08\u9375\u8207\u5c0d\u61c9\u95dc\u4fc2\uff09<\/h3>\n<p>\u6b64\u529f\u80fd\u85cd\u5716\u6a21\u64ec\u4e86\u6838\u5fc3\u96fb\u5b50\u5546\u52d9\u8cc7\u6599\u5eab\u7684\u4ea4\u6613\u5faa\u74b0\uff0c\u5c55\u793a\u4f7f\u7528\u8005\u3001\u8a02\u55ae\u8207\u4ed8\u6b3e\u8ffd\u8e64\u7cfb\u7d71\u5982\u4f55\u900f\u904e\u56b4\u683c\u7684\u70cf\u9d09\u8173\u7d04\u675f\u9023\u7d50\u5728\u4e00\u8d77\u3002<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Mermaid<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNqNkM0KwjAQhO+C7xB69wW8iVURfyptPYelXWuwSSS7RcT67qZU8aeC7inMJJlvB12ooHCg+z3hZ7xN0mg1iRNxaYVmlGGhcrFZPCVip0whUIMqO+oRiE7W5XIPtG\/da7\/XHqI4\/P17I2UVsdXopPemL16OmdJQCrYMpQRtK8MdAmLgij6i03i0TkbjdB6t5XISzv7j8Ht0Ie4xDnfo0GQo2R7QdPwCGE9w\/uB4dlzXg4G9PDoZiuBYQoYUvFXVXKrrr\/T+RYEGnY+h4Aa9SHin\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Mermaid<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAufQ4BB\/X9egYIVqiAAIZOaVKGSmKAR4I4SKS4oy89IVUnMTM3MwRAsSi4vL84tS4jMSizMgsrW8XBCGf5ALYdNBQsmlxSX5ualF8UA5NyS5lNTkzNzEHIWS\/JLEnPjE3PzSvBIMFxSXJJaUFqNZHRLk6Bfs6Bzi6e8X7+Pq4k6cO4D+wHQE1Jqi1LTUotS85NT4kvzs1DwM+fTEktTyxEo0dyDCuKZGVze\/GhYmVgpKT3Z0v1jR9HTaOiWU0AKpq6nB6gGgpudTFj2fMl8JAHEDfQo=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-mermaid\"><code class=\"language-mermaid\" data-language=\"mermaid\" class=\"language-mermaid\">erDiagram\r\n    CUSTOMERS {\r\n        int id PK\r\n        string email\r\n        string password_hash\r\n    }\r\n\r\n    ORDERS {\r\n        int id PK\r\n        int customer_id FK\r\n        decimal total_amount\r\n        string status\r\n    }\r\n\r\n    TRANSACTION_LEDGERS {\r\n        int id PK\r\n        int order_id FK\r\n        string reference_token\r\n        string gateway\r\n    }\r\n\r\n    CUSTOMERS ||--o{ ORDERS : \"\u4e0b\u8a02\u55ae\"\r\n    ORDERS ||--|| TRANSACTION_LEDGERS : \"\u7522\u751f\"<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAAufQ4BB\/X9egYIVqiAAIZOaVKGSmKAR4I4SKS4oy89IVUnMTM3MwRAsSi4vL84tS4jMSizMgsrW8XBCGf5ALYdNBQsmlxSX5ualF8UA5NyS5lNTkzNzEHIWS\/JLEnPjE3PzSvBIMFxSXJJaUFqNZHRLk6Bfs6Bzi6e8X7+Pq4k6cO4D+wHQE1Jqi1LTUotS85NT4kvzs1DwM+fTEktTyxEo0dyDCuKZGVze\/GhYmVgpKT3Z0v1jR9HTaOiWU0AKpq6nB6gGgpudTFj2fMl8JAHEDfQo=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNqNkM0KwjAQhO+C7xB69wW8iVURfyptPYelXWuwSSS7RcT67qZU8aeC7inMJJlvB12ooHCg+z3hZ7xN0mg1iRNxaYVmlGGhcrFZPCVip0whUIMqO+oRiE7W5XIPtG\/da7\/XHqI4\/P17I2UVsdXopPemL16OmdJQCrYMpQRtK8MdAmLgij6i03i0TkbjdB6t5XISzv7j8Ht0Ie4xDnfo0GQo2R7QdPwCGE9w\/uB4dlzXg4G9PDoZiuBYQoYUvFXVXKrrr\/T+RYEGnY+h4Aa9SHin\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"qqEcCcA\"><img fetchpriority=\"high\" alt=\"\" class=\"alignnone size-full wp-image-632\" decoding=\"async\" fetchpriority=\"high\" height=\"817\" sizes=\"(max-width: 268px) 100vw, 268px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451.png 268w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903b8be451-98x300.png 98w\" width=\"268\"\/><\/p>\n<p><strong>\u8a9e\u6cd5\u89e3\u6790\uff1a<\/strong> \u6b64\u67b6\u69cb\u6e05\u6670\u5730\u6620\u5c04\u4e86\u4ea4\u6613\u908a\u754c\u3002\u5c0d\u61c9\u898f\u5247\u898f\u5b9a\uff0c\u5ba2\u6236\u5728\u4e00\u6bb5\u6642\u9593\u5167\u53ef\u4ee5\u4e0b\u96f6\u7b46\u6216\u591a\u7b46\u8a02\u55ae\uff08<code>||--o{<\/code>\uff09\uff0c\u800c\u55ae\u7b46\u8a02\u55ae\u8a18\u9304\u5fc5\u9808\u7522\u751f\u6070\u597d\u4e00\u7b46\u5c0d\u61c9\u7684\u4ea4\u6613\u5e33\u672c\u689d\u76ee\uff08<code>||--||<\/code>).<\/p>\n<h3>\u7bc4\u4f8b 2\uff1a\u4f01\u696d\u5167\u5bb9\u7ba1\u7406\u7cfb\u7d71\u67b6\u69cb\uff08\u591a\u5c0d\u591a\u4ea4\u96c6\uff09<\/h3>\n<p>\u6b64\u9032\u968e\u8cc7\u6599\u5eab\u85cd\u5716\u898f\u5283\u4e86\u5167\u5bb9\u7ba1\u7406\u5e73\u53f0\u7684\u67b6\u69cb\u3002\u5b83\u8a73\u7d30\u8aaa\u660e\u4e86\u5982\u4f55\u900f\u904e\u5f15\u5165\u660e\u78ba\u7684\u6a4b\u63a5\u5c0d\u61c9\u5be6\u9ad4\u4f86\u89e3\u6c7a\u8907\u96dc\u7684\u591a\u5c0d\u591a\u914d\u7f6e\u3002<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Mermaid<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNqNkU1uwjAQhfdI3GHEulygO9QGhFBIRNh0ZU0d14wU25E9SCDo3RuTtjQ1FZ2VPT9+\/t4o\/0yoPZrxCLooi2pbwam\/xCDLQDWUq2sqsCergYkblWRDs9fXJKsDw6urj0I6y8pyX3ofj\/rD02ybLYrNMvunpkWTStYqSE8tk7O\/no804lPjReSzslyuF4lU6wKLi94DzFfDmkRW2vnjrTqTUYHRtIAhkLaqFpgAFnmere9a+vMb8xQb97xzXgzpL95KZ0xnq4ge34Cv4HyeTt3pLyceYRIXg2TDJNnI\/dEmgr+R+hoeSH6jd53IjHLX9X0AN3qkJw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Mermaid<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAggD\/4JBghWoIBwQy80oUMlMUArwRQsUlRZl56QolmSU5qRiixTml6QjBktSKEoWk\/JTK+OT8vJLUvBKIVC0vF4Th7Bji6u4f5OlKpJ15ibmYVqakFicXZRaUZObnoRkP8k081I7IeF\/HgABPP3cMqwryi0viwfbpKLh5o8olJ5akpucXVWKTL8nMTS0uScwtUEgsLs5Mz0tNiU\/E8KC\/r6+rH8EgRXaGG6a3E0tLMvKL4lF9Dw7b5PzcXGCwxoPCGIvngxVqanR186txhYSVgtLTntanE1YrYcQHYY0dbS8XzlPCYhnc00BVL2e2PO1aoAQA1mSlmw==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-mermaid\"><code class=\"language-mermaid\" data-language=\"mermaid\" class=\"language-mermaid\">erDiagram\r\n    POSTS {\r\n        int id PK\r\n        string title\r\n        string slug\r\n        text body_content\r\n    }\r\n\r\n    CATEGORIES {\r\n        int id PK\r\n        string name\r\n        string description\r\n    }\r\n\r\n    POST_CATEGORY_MAPPINGS {\r\n        int post_id PK, FK\r\n        int category_id PK, FK\r\n        timestamp assigned_at\r\n    }\r\n\r\n    COMMENTS {\r\n        int id PK\r\n        int post_id FK\r\n        string author_name\r\n        text comment_body\r\n    }\r\n\r\n    POSTS ||--o{ POST_CATEGORY_MAPPINGS : \"\u5305\u542b\"\r\n    CATEGORIES ||--o{ POST_CATEGORY_MAPPINGS : \"\u5206\u985e\"\r\n    POSTS ||--o{ COMMENTS : \"\u9644\u52a0\"<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNpLLXLJTEwvSszl5VIAggD\/4JBghWoIBwQy80oUMlMUArwRQsUlRZl56QolmSU5qRiixTml6QjBktSKEoWk\/JTK+OT8vJLUvBKIVC0vF4Th7Bji6u4f5OlKpJ15ibmYVqakFicXZRaUZObnoRkP8k081I7IeF\/HgABPP3cMqwryi0viwfbpKLh5o8olJ5akpucXVWKTL8nMTS0uScwtUEgsLs5Mz0tNiU\/E8KC\/r6+rH8EgRXaGG6a3E0tLMvKL4lF9Dw7b5PzcXGCwxoPCGIvngxVqanR186txhYSVgtLTntanE1YrYcQHYY0dbS8XzlPCYhnc00BVL2e2PO1aoAQA1mSlmw==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Mermaid in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#mermaid:eNqNkU1uwjAQhfdI3GHEulygO9QGhFBIRNh0ZU0d14wU25E9SCDo3RuTtjQ1FZ2VPT9+\/t4o\/0yoPZrxCLooi2pbwam\/xCDLQDWUq2sqsCergYkblWRDs9fXJKsDw6urj0I6y8pyX3ofj\/rD02ybLYrNMvunpkWTStYqSE8tk7O\/no804lPjReSzslyuF4lU6wKLi94DzFfDmkRW2vnjrTqTUYHRtIAhkLaqFpgAFnmere9a+vMb8xQb97xzXgzpL95KZ0xnq4ge34Cv4HyeTt3pLyceYRIXg2TDJNnI\/dEmgr+R+hoeSH6jd53IjHLX9X0AN3qkJw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>\u5728 VPasCode \u4e2d\u7de8\u8f2f Mermaid<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"NkBriQB\"><img loading=\"lazy\" alt=\"\" class=\"alignnone size-full wp-image-633\" decoding=\"async\" height=\"545\" loading=\"lazy\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903d115d5e.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903d115d5e.png 709w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/05\/img_6a1903d115d5e-300x231.png 300w\" width=\"709\"\/><\/p>\n<p><strong>\u8a9e\u6cd5\u89e3\u6790\uff1a<\/strong> \u70ba\u8655\u7406 `POSTS` \u8207 `CATEGORIES` \u4e4b\u9593\u7684\u591a\u5c0d\u591a\u95dc\u4fc2\uff0c\u8a72\u8173\u672c\u5f15\u5165\u4e86\u4e00\u500b\u4ea4\u96c6\u8868\u683c\uff08`POST_CATEGORY_MAPPINGS`\uff09\u3002\u6b64\u5c0d\u61c9\u6846\u4f7f\u7528\u8907\u5408\u9375\uff0c\u540c\u6642\u4f5c\u70ba\u4e3b\u9375\u8207\u5916\u9375\uff08<code>PK FK<\/code>\uff09\uff0c\u4e26\u4f7f\u7528\u6a19\u6e96\u7684\u591a\u5c0d\u4e00\u70cf\u9d09\u8173\u9023\u63a5\u5c07\u5916\u90e8\u7bc0\u9ede\u9023\u7d50\u5728\u4e00\u8d77\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u9ebc\u662f\u5be6\u9ad4\u95dc\u4fc2\u5716\uff08ERD\uff09\uff1f \u4e00\u500b\u5be6\u9ad4\u95dc\u4fc2\u5716\uff08ERD\uff09\u662f\u4e00\u7a2e\u7d50\u69cb\u85cd\u5716\uff0c\u7528\u65bc\u8a2d\u8a08\u3001&#8230;<\/p>\n","protected":false},"author":4,"featured_media":2277,"parent":0,"menu_order":4,"template":"","meta":{"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"ld_collection":[14],"class_list":["post-2276","ld_docs","type-ld_docs","status-publish","has-post-thumbnail","hentry","ld_collection-vpascode-docs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide<\/title>\n<meta name=\"description\" content=\"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide\" \/>\n<meta property=\"og:description\" content=\"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"VPasCode\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/05\/img_6a1903d115d5e-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"709\" \/>\n\t<meta property=\"og:image:height\" content=\"545\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/\",\"name\":\"Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/05\\\/img_6a1903d115d5e-1.png\",\"datePublished\":\"2026-05-26T08:05:43+00:00\",\"description\":\"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/05\\\/img_6a1903d115d5e-1.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/05\\\/img_6a1903d115d5e-1.png\",\"width\":709,\"height\":545},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/vpascode-docs\\\/mermaid-js-erd-syntax-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lean Docs\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/docs\\\/%ld_collection%\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Mermaid.js ERD \u8a9e\u6cd5\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#website\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/\",\"name\":\"VPasCode\",\"description\":\"by Visual Paradigm\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#organization\",\"name\":\"VPasCode\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"width\":128,\"height\":138,\"caption\":\"VPasCode\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/tw\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide","description":"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/","og_locale":"zh_TW","og_type":"article","og_title":"Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide","og_description":"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.","og_url":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/","og_site_name":"VPasCode","og_image":[{"width":709,"height":545,"url":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/05\/img_6a1903d115d5e-1.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u9810\u4f30\u95b1\u8b80\u6642\u9593":"4 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/","url":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/","name":"Mermaid ERD Diagram Syntax | VPasCode Text to Diagram Guide","isPartOf":{"@id":"https:\/\/www.vpascode.com\/tw\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/#primaryimage"},"image":{"@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/05\/img_6a1903d115d5e-1.png","datePublished":"2026-05-26T08:05:43+00:00","description":"Draft database schemas effortlessly using Mermaid entity relationship diagrams in VPasCode, your text to diagram tool.","breadcrumb":{"@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/"]}]},{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/#primaryimage","url":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/05\/img_6a1903d115d5e-1.png","contentUrl":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/05\/img_6a1903d115d5e-1.png","width":709,"height":545},{"@type":"BreadcrumbList","@id":"https:\/\/www.vpascode.com\/tw\/docs\/vpascode-docs\/mermaid-js-erd-syntax-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vpascode.com\/tw\/"},{"@type":"ListItem","position":2,"name":"Lean Docs","item":"https:\/\/www.vpascode.com\/tw\/docs\/%ld_collection%\/"},{"@type":"ListItem","position":3,"name":"Mermaid.js ERD \u8a9e\u6cd5\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.vpascode.com\/tw\/#website","url":"https:\/\/www.vpascode.com\/tw\/","name":"VPasCode","description":"by Visual Paradigm","publisher":{"@id":"https:\/\/www.vpascode.com\/tw\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vpascode.com\/tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/www.vpascode.com\/tw\/#organization","name":"VPasCode","url":"https:\/\/www.vpascode.com\/tw\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.vpascode.com\/tw\/#\/schema\/logo\/image\/","url":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/06\/cropped-vp-online-logo-v1.png","contentUrl":"https:\/\/www.vpascode.com\/tw\/wp-content\/uploads\/sites\/2\/2026\/06\/cropped-vp-online-logo-v1.png","width":128,"height":138,"caption":"VPasCode"},"image":{"@id":"https:\/\/www.vpascode.com\/tw\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/ld_docs\/2276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/ld_docs"}],"about":[{"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/types\/ld_docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/users\/4"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/media\/2277"}],"wp:attachment":[{"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/media?parent=2276"}],"wp:term":[{"taxonomy":"ld_collection","embeddable":true,"href":"https:\/\/www.vpascode.com\/tw\/wp-json\/wp\/v2\/ld_collection?post=2276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}