{"id":1526,"date":"2025-02-10T23:46:57","date_gmt":"2025-02-10T15:46:57","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1526"},"modified":"2025-02-10T23:46:58","modified_gmt":"2025-02-10T15:46:58","slug":"%e5%bc%80%e5%8f%91%e8%80%85%e5%b8%b8%e8%a7%81%e7%9a%84sql%e8%af%af%e5%8c%ba%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%ef%bc%9a%e9%81%bf%e5%85%8d%e4%bd%8e%e6%95%88%e6%9f%a5%e8%af%a2%e5%92%8c","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/10\/%e5%bc%80%e5%8f%91%e8%80%85%e5%b8%b8%e8%a7%81%e7%9a%84sql%e8%af%af%e5%8c%ba%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%ef%bc%9a%e9%81%bf%e5%85%8d%e4%bd%8e%e6%95%88%e6%9f%a5%e8%af%a2%e5%92%8c\/","title":{"rendered":"\u5f00\u53d1\u8005\u5e38\u89c1\u7684SQL\u8bef\u533a\u53ca\u89e3\u51b3\u65b9\u6848\uff1a\u907f\u514d\u4f4e\u6548\u67e5\u8be2\u548c\u6570\u636e\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728\u4f7f\u7528SQL\u65f6\uff0c\u5f00\u53d1\u8005\u5e38\u5e38\u4f1a\u72af\u4e00\u4e9b\u8bef\u533a\uff0c\u8fd9\u4e9b\u8bef\u533a\u53ef\u80fd\u5bfc\u81f4\u6027\u80fd\u4f4e\u4e0b\u3001\u6570\u636e\u4e0d\u4e00\u81f4\u6216\u8005\u51fa\u73b0\u9519\u8bef\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684SQL\u8bef\u533a\uff0c\u4ee5\u53ca\u5982\u4f55\u907f\u514d\u5b83\u4eec\u7684\u5efa\u8bae\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u8bef\u533a\uff1a\u6ca1\u6709\u4f7f\u7528\u5408\u9002\u7684\u7d22\u5f15<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ca1\u6709\u4e3a\u67e5\u8be2\u64cd\u4f5c\u521b\u5efa\u5408\u9002\u7684\u7d22\u5f15\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u67e5\u8be2\u6027\u80fd\u6025\u5267\u4e0b\u964d\uff0c\u5c24\u5176\u662f\u5f53\u8868\u7684\u6570\u636e\u91cf\u5f88\u5927\u65f6\u3002\u6ca1\u6709\u7d22\u5f15\uff0c\u6570\u636e\u5e93\u5c06\u8fdb\u884c\u5168\u8868\u626b\u63cf\uff0c\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u4f4e\u6548\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e3a\u7ecf\u5e38\u7528\u4e8e\u67e5\u8be2\u7684\u5217\uff08\u5982 <code>WHERE<\/code> \u5b50\u53e5\u4e2d\u7684\u5217\u3001<code>JOIN<\/code> \u5b50\u53e5\u4e2d\u7684\u5217\uff09\u521b\u5efa\u7d22\u5f15\u3002<\/li>\n\n\n\n<li>\u5b9a\u671f\u68c0\u67e5\u67e5\u8be2\u6027\u80fd\uff0c\u4f7f\u7528 <code>EXPLAIN<\/code> \u8bed\u53e5\u5206\u6790\u67e5\u8be2\u6267\u884c\u8ba1\u5212\u3002<\/li>\n\n\n\n<li>\u907f\u514d\u5728\u9891\u7e41\u66f4\u65b0\u7684\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff0c\u56e0\u4e3a\u7d22\u5f15\u4f1a\u589e\u52a0\u63d2\u5165\u548c\u66f4\u65b0\u64cd\u4f5c\u7684\u5f00\u9500\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u8bef\u533a\uff1a\u5728 SELECT \u4e2d\u4f7f\u7528 <code>SELECT *<\/code><\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528 <code>SELECT *<\/code> \u4f1a\u9009\u62e9\u6240\u6709\u5217\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4e0d\u5fc5\u8981\u7684\u6570\u636e\u4f20\u8f93\uff0c\u5c24\u5176\u662f\u5728\u6570\u636e\u8868\u4e2d\u6709\u5f88\u591a\u5217\u65f6\u3002\u5b83\u8fd8\u4f1a\u5f71\u54cd\u6027\u80fd\uff0c\u5c24\u5176\u662f\u5f53\u67e5\u8be2\u7ed3\u679c\u96c6\u5f88\u5927\u65f6\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u53ea\u9009\u62e9\u4f60\u9700\u8981\u7684\u5217\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code>SELECT *<\/code>\u3002<\/li>\n\n\n\n<li>\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u6570\u636e\u4f20\u8f93\u91cf\uff0c\u4f18\u5316\u67e5\u8be2\u901f\u5ea6\uff0c\u907f\u514d\u5728\u7ed3\u679c\u4e2d\u83b7\u53d6\u4e0d\u5fc5\u8981\u7684\u6570\u636e\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u4e0d\u63a8\u8350\nSELECT * FROM users;\n\n-- \u63a8\u8350\nSELECT id, username, email FROM users;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. \u8bef\u533a\uff1a\u5ffd\u89c6\u4e8b\u52a1\u7684\u4f7f\u7528<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ca1\u6709\u4f7f\u7528\u4e8b\u52a1\u6765\u786e\u4fdd\u64cd\u4f5c\u7684\u539f\u5b50\u6027\u548c\u4e00\u81f4\u6027\u3002\u5f53\u591a\u4e2a\u64cd\u4f5c\u6d89\u53ca\u5230\u6570\u636e\u53d8\u66f4\u65f6\uff0c\u5982\u679c\u6ca1\u6709\u4e8b\u52a1\uff0c\u53ef\u80fd\u4f1a\u53d1\u751f\u90e8\u5206\u64cd\u4f5c\u6210\u529f\u3001\u90e8\u5206\u64cd\u4f5c\u5931\u8d25\u7684\u60c5\u51b5\uff0c\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728\u6d89\u53ca\u591a\u4e2aSQL\u64cd\u4f5c\u7684\u60c5\u51b5\u4e0b\uff0c\u59cb\u7ec8\u4f7f\u7528\u4e8b\u52a1\u6765\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <code>BEGIN<\/code> \u5f00\u59cb\u4e8b\u52a1\uff0c\u4f7f\u7528 <code>COMMIT<\/code> \u63d0\u4ea4\u4e8b\u52a1\uff0c\u4f7f\u7528 <code>ROLLBACK<\/code> \u56de\u6eda\u4e8b\u52a1\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>BEGIN;\n\n-- \u6267\u884c\u4e00\u7cfb\u5217SQL\u64cd\u4f5c\nUPDATE users SET balance = balance - 100 WHERE id = 1;\nUPDATE users SET balance = balance + 100 WHERE id = 2;\n\nCOMMIT;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. \u8bef\u533a\uff1a\u6ca1\u6709\u6b63\u786e\u5904\u7406 NULL \u503c<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u67e5\u8be2\u4e2d\u6ca1\u6709\u8003\u8651 <code>NULL<\/code> \u503c\u7684\u7279\u6b8a\u6027\uff0c\u53ef\u80fd\u5bfc\u81f4\u4e0d\u6b63\u786e\u7684\u67e5\u8be2\u7ed3\u679c\u3002\u4f8b\u5982\uff0c<code>NULL<\/code> \u4e0d\u7b49\u4e8e <code>NULL<\/code>\uff0c\u5728 <code>WHERE<\/code> \u5b50\u53e5\u4e2d\u76f4\u63a5\u4f7f\u7528 <code>=<\/code> \u6765\u6bd4\u8f83 <code>NULL<\/code> \u4f1a\u5931\u8d25\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <code>IS NULL<\/code> \u6216 <code>IS NOT NULL<\/code> \u6765\u5904\u7406 <code>NULL<\/code> \u503c\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code>=<\/code> \u6216 <code>&lt;><\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u9519\u8bef\uff1a\u76f4\u63a5\u7528 `=` \u6765\u6bd4\u8f83 NULL\nSELECT * FROM users WHERE email = NULL;\n\n-- \u6b63\u786e\uff1a\u4f7f\u7528 `IS NULL`\nSELECT * FROM users WHERE email IS NULL;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. \u8bef\u533a\uff1a\u9891\u7e41\u66f4\u65b0\u6570\u636e\u5e93\u7ed3\u6784<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u9891\u7e41\u4fee\u6539\u6570\u636e\u5e93\u8868\u7684\u7ed3\u6784\uff08\u4f8b\u5982\u6dfb\u52a0\u6216\u5220\u9664\u5217\u3001\u4fee\u6539\u5217\u7c7b\u578b\uff09\u4f1a\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\uff0c\u5c24\u5176\u662f\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u3002\u6b64\u5916\uff0c\u8fd9\u6837\u7684\u64cd\u4f5c\u8fd8\u4f1a\u589e\u52a0\u6570\u636e\u8fc1\u79fb\u7684\u590d\u6742\u5ea6\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728\u8bbe\u8ba1\u6570\u636e\u5e93\u65f6\uff0c\u5c3d\u91cf\u8003\u8651\u5230\u5c06\u6765\u53ef\u80fd\u7684\u53d8\u66f4\uff0c\u907f\u514d\u9891\u7e41\u4fee\u6539\u8868\u7ed3\u6784\u3002<\/li>\n\n\n\n<li>\u5728\u4fee\u6539\u6570\u636e\u5e93\u7ed3\u6784\u65f6\uff0c\u5148\u5728\u5f00\u53d1\u6216\u6d4b\u8bd5\u73af\u5883\u4e2d\u9a8c\u8bc1\uff0c\u786e\u4fdd\u4e0d\u4f1a\u5f71\u54cd\u73b0\u6709\u6570\u636e\u548c\u5e94\u7528\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u7248\u672c\u63a7\u5236\u5de5\u5177\u7ba1\u7406\u6570\u636e\u5e93\u7684\u7ed3\u6784\u66f4\u6539\uff08\u5982Liquibase\u3001Flyway\u7b49\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. \u8bef\u533a\uff1a\u6ca1\u6709\u4f7f\u7528\u9002\u5f53\u7684\u5916\u952e\u7ea6\u675f<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u4f7f\u7528\u5916\u952e\u7ea6\u675f\u6765\u786e\u4fdd\u6570\u636e\u7684\u5b8c\u6574\u6027\uff0c\u53ef\u80fd\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5728\u5220\u9664\u4e00\u6761\u8bb0\u5f55\u65f6\u6ca1\u6709\u5220\u9664\u5173\u8054\u7684\u8bb0\u5f55\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b64\u7acb\u8bb0\u5f55\u5b58\u5728\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528\u5916\u952e\u7ea6\u675f\u6765\u786e\u4fdd\u8868\u4e4b\u95f4\u7684\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n\n\n\n<li>\u786e\u4fdd\u5728\u5220\u9664\u6216\u66f4\u65b0\u6570\u636e\u65f6\u9075\u5faa\u6570\u636e\u5b8c\u6574\u6027\u89c4\u5219\uff08\u5982 <code>ON DELETE CASCADE<\/code>\u3001<code>ON UPDATE CASCADE<\/code>\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u793a\u4f8b\uff1a\u4f7f\u7528\u5916\u952e\u7ea6\u675f\nCREATE TABLE orders (\n    id INT PRIMARY KEY,\n    user_id INT,\n    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. \u8bef\u533a\uff1a\u6ca1\u6709\u4f18\u5316\u67e5\u8be2\u8bed\u53e5<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f16\u5199\u7684SQL\u67e5\u8be2\u8bed\u53e5\u53ef\u80fd\u6ca1\u6709\u7ecf\u8fc7\u4f18\u5316\uff0c\u5bfc\u81f4\u67e5\u8be2\u65f6\u95f4\u8fc7\u957f\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\u3002\u6bd4\u5982\u6ca1\u6709\u4f7f\u7528\u9002\u5f53\u7684\u8fde\u63a5\u6761\u4ef6\uff0c\u6216\u8005\u4f7f\u7528\u4e86\u4e0d\u5fc5\u8981\u7684\u5b50\u67e5\u8be2\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <code>JOIN<\/code> \u6765\u4ee3\u66ff <code>IN<\/code> \u6216\u5b50\u67e5\u8be2\uff0c\u907f\u514d\u5197\u4f59\u67e5\u8be2\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <code>EXPLAIN<\/code> \u5206\u6790\u67e5\u8be2\u8ba1\u5212\uff0c\u786e\u4fdd\u6ca1\u6709\u6267\u884c\u4e0d\u5fc5\u8981\u7684\u5168\u8868\u626b\u63cf\u3002<\/li>\n\n\n\n<li>\u5c3d\u91cf\u907f\u514d\u5728\u67e5\u8be2\u4e2d\u4f7f\u7528\u5d4c\u5957\u7684\u5b50\u67e5\u8be2\uff0c\u7279\u522b\u662f\u90a3\u4e9b\u5728 <code>WHERE<\/code> \u5b50\u53e5\u4e2d\u8fdb\u884c\u7684\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. \u8bef\u533a\uff1a\u5ffd\u89c6 SQL \u6ce8\u5165\u6f0f\u6d1e<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ca1\u6709\u91c7\u53d6\u9884\u9632\u63aa\u65bd\uff0c\u5bfc\u81f4 SQL \u6ce8\u5165\u6f0f\u6d1e\u7684\u5b58\u5728\u3002\u653b\u51fb\u8005\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165\u6076\u610f\u7684SQL\u4ee3\u7801\uff0c\u64cd\u63a7\u6570\u636e\u5e93\uff0c\u751a\u81f3\u6267\u884c\u7834\u574f\u6027\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u59cb\u7ec8\u4f7f\u7528\u53c2\u6570\u5316\u67e5\u8be2\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u62fc\u63a5\u7528\u6237\u8f93\u5165\u7684SQL\u8bed\u53e5\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528ORM\u6846\u67b6\uff08\u5982SQLAlchemy\uff09\u65f6\uff0c\u907f\u514d\u76f4\u63a5\u64cd\u4f5c\u539f\u751fSQL\u8bed\u53e5\uff0c\u5229\u7528ORM\u63d0\u4f9b\u7684\u67e5\u8be2\u63a5\u53e3\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># \u9519\u8bef\uff1a\u76f4\u63a5\u62fc\u63a5SQL\u67e5\u8be2\ncursor.execute(f\"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'\")\n\n# \u6b63\u786e\uff1a\u4f7f\u7528\u53c2\u6570\u5316\u67e5\u8be2\ncursor.execute(\"SELECT * FROM users WHERE username = %s AND password = %s\", (username, password))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>9. \u8bef\u533a\uff1a\u4e0d\u8fdb\u884c\u6570\u636e\u5e93\u6027\u80fd\u5206\u6790<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1\u8005\u53ef\u80fd\u4e0d\u91cd\u89c6\u6570\u636e\u5e93\u6027\u80fd\u5206\u6790\uff0c\u5bfc\u81f4\u67d0\u4e9b\u67e5\u8be2\u5728\u6570\u636e\u91cf\u589e\u5927\u65f6\u8868\u73b0\u5f88\u5dee\uff0c\u751a\u81f3\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9a\u671f\u4f7f\u7528\u5de5\u5177\uff08\u5982 <code>EXPLAIN<\/code>\uff09\u5206\u6790\u67e5\u8be2\u7684\u6267\u884c\u8ba1\u5212\uff0c\u68c0\u67e5\u662f\u5426\u6709\u6027\u80fd\u74f6\u9888\u3002<\/li>\n\n\n\n<li>\u9488\u5bf9\u590d\u6742\u7684\u67e5\u8be2\uff0c\u4f7f\u7528\u7d22\u5f15\u6765\u52a0\u901f\u6570\u636e\u68c0\u7d22\u3002<\/li>\n\n\n\n<li>\u76d1\u63a7\u6570\u636e\u5e93\u7684\u8d1f\u8f7d\u548c\u6027\u80fd\uff0c\u5b9a\u671f\u4f18\u5316\u67e5\u8be2\u548c\u6570\u636e\u5e93\u914d\u7f6e\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>10. \u8bef\u533a\uff1a\u4e0d\u8003\u8651\u6570\u636e\u5e93\u7684\u6269\u5c55\u6027<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1\u8005\u901a\u5e38\u5728\u8bbe\u8ba1\u6570\u636e\u5e93\u65f6\u53ea\u8003\u8651\u5f53\u524d\u7684\u9700\u6c42\uff0c\u800c\u6ca1\u6709\u8003\u8651\u5230\u6570\u636e\u91cf\u7684\u589e\u957f\u6216\u5e94\u7528\u7684\u6269\u5c55\u6027\u3002\u968f\u7740\u6570\u636e\u91cf\u589e\u52a0\uff0c\u521d\u671f\u7684\u8bbe\u8ba1\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u74f6\u9888\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8bbe\u8ba1\u65f6\u8981\u8003\u8651\u6570\u636e\u7684\u589e\u957f\u60c5\u51b5\uff0c\u5408\u7406\u9009\u62e9\u6570\u636e\u5e93\u67b6\u6784\u3002<\/li>\n\n\n\n<li>\u91c7\u7528\u5206\u533a\u3001\u5206\u8868\u7b49\u6280\u672f\u6765\u5206\u6563\u6570\u636e\u5b58\u50a8\uff0c\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u5408\u9002\u7684\u7d22\u5f15\uff0c\u907f\u514d\u8fc7\u5ea6\u7d22\u5f15\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002<\/li>\n\n\n\n<li>\u5b9a\u671f\u8bc4\u4f30\u6570\u636e\u5e93\u7684\u8d1f\u8f7d\uff0c\u505a\u51fa\u9002\u65f6\u7684\u4f18\u5316\u6216\u8c03\u6574\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>11. \u8bef\u533a\uff1a\u672a\u4f7f\u7528\u6570\u636e\u5e93\u89c4\u8303\u5316<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6570\u636e\u5e93\u8bbe\u8ba1\u65f6\u672a\u9075\u5faa\u8303\u5f0f\uff08Normalization\uff09\u89c4\u8303\uff0c\u5bfc\u81f4\u6570\u636e\u5197\u4f59\u548c\u4e00\u81f4\u6027\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u5197\u4f59\u7684\u5b57\u6bb5\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u66f4\u65b0\u6216\u5220\u9664\u6570\u636e\u65f6\u53ef\u80fd\u9700\u8981\u591a\u4e2a\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8bbe\u8ba1\u65f6\u9075\u5faa\u6570\u636e\u5e93\u8303\u5f0f\uff0c\u81f3\u5c11\u8fbe\u5230\u7b2c\u4e09\u8303\u5f0f\uff083NF\uff09\uff0c\u907f\u514d\u6570\u636e\u5197\u4f59\u3002<\/li>\n\n\n\n<li>\u5728\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u9002\u5f53\u4f7f\u7528\u53cd\u8303\u5f0f\u5316\u4ee5\u63d0\u5347\u67e5\u8be2\u6548\u7387\uff0c\u4f46\u8981\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n\n\n\n<li>\u5728\u8bbe\u8ba1\u65f6\u8003\u8651\u6570\u636e\u7684\u5b8c\u6574\u6027\u548c\u4e00\u81f4\u6027\uff0c\u786e\u4fdd\u5173\u7cfb\u548c\u7ea6\u675f\u7684\u6b63\u786e\u6027\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>12. \u8bef\u533a\uff1a\u5ffd\u89c6\u5206\u9875\u67e5\u8be2<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u67e5\u8be2\u5927\u91cf\u6570\u636e\u65f6\uff0c\u672a\u8fdb\u884c\u5206\u9875\u67e5\u8be2\u6216\u9650\u5236\u8fd4\u56de\u6570\u636e\u7684\u6570\u91cf\uff0c\u5bfc\u81f4\u67e5\u8be2\u7ed3\u679c\u8fc7\u5927\uff0c\u9020\u6210\u5185\u5b58\u6ea2\u51fa\u6216\u6570\u636e\u5e93\u8d1f\u8f7d\u8fc7\u9ad8\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <code>LIMIT<\/code> \u6216 <code>OFFSET<\/code> \u6765\u8fdb\u884c\u5206\u9875\u67e5\u8be2\uff0c\u907f\u514d\u4e00\u6b21\u6027\u8fd4\u56de\u8fc7\u591a\u6570\u636e\u3002<\/li>\n\n\n\n<li>\u5728\u67e5\u8be2\u65f6\u9650\u5236\u8fd4\u56de\u7684\u884c\u6570\uff0c\u5c24\u5176\u662f\u5728\u8fd4\u56de\u6570\u636e\u91cf\u5f88\u5927\u7684\u60c5\u51b5\u4e0b\uff0c\u5206\u9875\u662f\u975e\u5e38\u5fc5\u8981\u7684\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u4f7f\u7528 LIMIT \u548c OFFSET \u8fdb\u884c\u5206\u9875\u67e5\u8be2\nSELECT * FROM users ORDER BY id LIMIT 20 OFFSET 40;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>13. \u8bef\u533a\uff1a\u4e0d\u8003\u8651\u8bfb\u5199\u5206\u79bb<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u9ad8\u5e76\u53d1\u5e94\u7528\u4e2d\uff0c\u6570\u636e\u5e93\u7684\u8bfb\u5199\u538b\u529b\u901a\u5e38\u4f1a\u96c6\u4e2d\u5728\u4e00\u4e2a\u8282\u70b9\u4e0a\uff0c\u5bfc\u81f4\u6027\u80fd\u74f6\u9888\u3002\u8bb8\u591a\u5f00\u53d1\u8005\u5ffd\u89c6\u4e86\u8bfb\u5199\u5206\u79bb\u7684\u6982\u5ff5\uff0c\u5bfc\u81f4\u6570\u636e\u5e93\u8bfb\u5199\u64cd\u4f5c\u90fd\u96c6\u4e2d\u5728\u4e3b\u5e93\u4e0a\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9e\u73b0\u8bfb\u5199\u5206\u79bb\uff0c\u5373\u5c06\u5199\u64cd\u4f5c\uff08INSERT\u3001UPDATE\u3001DELETE\uff09\u96c6\u4e2d\u5728\u4e3b\u5e93\uff0c\u800c\u8bfb\u53d6\u64cd\u4f5c\uff08SELECT\uff09\u5219\u901a\u8fc7\u526f\u672c\uff08Replica\uff09\u8fdb\u884c\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u6570\u636e\u5e93\u4ee3\u7406\u6216\u4e2d\u95f4\u4ef6\uff08\u5982 MySQL \u7684 ProxySQL\uff09\u6765\u81ea\u52a8\u5b9e\u73b0\u8bfb\u5199\u5206\u79bb\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14. \u8bef\u533a\uff1a\u9891\u7e41\u5730\u8fdb\u884c\u6570\u636e\u5e93\u9501\u64cd\u4f5c<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u9891\u7e41\u4f7f\u7528\u6570\u636e\u5e93\u9501\uff08\u5982 <code>LOCK<\/code>\u3001<code>SELECT FOR UPDATE<\/code>\uff09\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6b7b\u9501\u6216\u6027\u80fd\u74f6\u9888\uff0c\u5c24\u5176\u662f\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e2d\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5c3d\u91cf\u907f\u514d\u957f\u65f6\u95f4\u6301\u6709\u9501\uff0c\u4fdd\u6301\u9501\u7684\u7c92\u5ea6\u5c3d\u53ef\u80fd\u5c0f\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u5408\u9002\u7684\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\u6765\u51cf\u5c11\u9501\u51b2\u7a81\uff0c\u907f\u514d\u6b7b\u9501\u3002<\/li>\n\n\n\n<li>\u5c3d\u91cf\u907f\u514d\u5728\u67e5\u8be2\u4e2d\u4f7f\u7528 <code>SELECT FOR UPDATE<\/code>\uff0c\u9664\u975e\u786e\u5b9e\u9700\u8981\u9501\u5b9a\u884c\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>15. \u8bef\u533a\uff1a\u4e0d\u4f7f\u7528\u6570\u636e\u5b8c\u6574\u6027\u7ea6\u675f<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6570\u636e\u5e93\u8868\u8bbe\u8ba1\u65f6\u6ca1\u6709\u4f7f\u7528\u9002\u5f53\u7684\u6570\u636e\u5b8c\u6574\u6027\u7ea6\u675f\uff08\u5982\u4e3b\u952e\u3001\u5916\u952e\u3001\u552f\u4e00\u7ea6\u675f\u7b49\uff09\uff0c\u53ef\u80fd\u5bfc\u81f4\u810f\u6570\u636e\u6216\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728\u6570\u636e\u5e93\u8bbe\u8ba1\u65f6\uff0c\u4e3a\u6bcf\u4e2a\u8868\u5b9a\u4e49\u4e3b\u952e\uff0c\u786e\u4fdd\u6570\u636e\u7684\u552f\u4e00\u6027\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u5916\u952e\u7ea6\u675f\u786e\u4fdd\u8868\u4e4b\u95f4\u7684\u5f15\u7528\u5b8c\u6574\u6027\u3002<\/li>\n\n\n\n<li>\u4e3a\u9700\u8981\u552f\u4e00\u7684\u5b57\u6bb5\uff08\u5982\u90ae\u7bb1\u3001\u7528\u6237\u540d\uff09\u6dfb\u52a0\u552f\u4e00\u7ea6\u675f\uff0c\u9632\u6b62\u91cd\u590d\u6570\u636e\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u521b\u5efa\u5916\u952e\u7ea6\u675f\nCREATE TABLE orders (\n    id INT PRIMARY KEY,\n    user_id INT,\n    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n);\n\n-- \u6dfb\u52a0\u552f\u4e00\u7ea6\u675f\nCREATE TABLE users (\n    id INT PRIMARY KEY,\n    email VARCHAR(255) UNIQUE\n);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>16. \u8bef\u533a\uff1a\u8fc7\u4e8e\u4f9d\u8d56 ORM\uff08\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff09<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">ORM\u5de5\u5177\u5982Hibernate\u3001SQLAlchemy\u7b49\u63d0\u4f9b\u4e86\u65b9\u4fbf\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u63a5\u53e3\uff0c\u4f46\u8fc7\u5ea6\u4f9d\u8d56ORM\u53ef\u80fd\u5bfc\u81f4\u4f4e\u6548\u7684\u67e5\u8be2\u548c\u4e0d\u5fc5\u8981\u7684\u590d\u6742\u6027\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u867d\u7136ORM\u65b9\u4fbf\u5feb\u6377\uff0c\u4f46\u5728\u9762\u5bf9\u590d\u6742\u67e5\u8be2\u548c\u6027\u80fd\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u65f6\uff0c\u76f4\u63a5\u4f7f\u7528\u539f\u751fSQL\u8bed\u53e5\u901a\u5e38\u66f4\u9ad8\u6548\u3002<\/li>\n\n\n\n<li>\u5728\u4f7f\u7528ORM\u65f6\uff0c\u4e86\u89e3\u5b83\u751f\u6210\u7684SQL\u67e5\u8be2\uff0c\u907f\u514d\u751f\u6210\u4e0d\u5fc5\u8981\u7684\u67e5\u8be2\u6216\u4f4e\u6548\u7684\u67e5\u8be2\u3002<\/li>\n\n\n\n<li>\u5728\u6027\u80fd\u5173\u952e\u7684\u5730\u65b9\uff0c\u8003\u8651\u624b\u52a8\u4f18\u5316\u67e5\u8be2\uff0c\u800c\u4e0d\u4ec5\u4ec5\u4f9d\u8d56ORM\u81ea\u52a8\u751f\u6210\u7684SQL\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>17. \u8bef\u533a\uff1a\u672a\u505a SQL \u8bed\u53e5\u4f18\u5316<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1\u8005\u901a\u5e38\u5728\u5199SQL\u65f6\u5ffd\u7565\u4e86\u67e5\u8be2\u4f18\u5316\uff0c\u5bfc\u81f4\u67e5\u8be2\u6548\u7387\u4f4e\u4e0b\u3002\u5e38\u89c1\u7684\u8bef\u533a\u6709\uff1a\u4f7f\u7528\u4e0d\u5fc5\u8981\u7684\u5b50\u67e5\u8be2\u3001\u6ca1\u6709\u4f7f\u7528\u5408\u9002\u7684\u7d22\u5f15\u3001\u67e5\u8be2\u6761\u4ef6\u4e0d\u5408\u7406\u7b49\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u59cb\u7ec8\u68c0\u67e5\u67e5\u8be2\u662f\u5426\u80fd\u4f18\u5316\uff0c\u4f8b\u5982\u4f7f\u7528 <code>JOIN<\/code> \u4ee3\u66ff <code>IN<\/code> \u5b50\u67e5\u8be2\uff0c\u6216\u8005\u4f18\u5316\u67e5\u8be2\u6761\u4ef6\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u7d22\u5f15\u52a0\u901f\u67e5\u8be2\uff0c\u5c24\u5176\u662f\u67e5\u8be2\u4e2d\u6d89\u53ca\u7684\u5b57\u6bb5\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u590d\u6742\u7684\u67e5\u8be2\uff0c\u4f7f\u7528\u6570\u636e\u5e93\u63d0\u4f9b\u7684\u67e5\u8be2\u5206\u6790\u5de5\u5177\uff08\u5982 <code>EXPLAIN<\/code>\uff09\u6765\u4f18\u5316\u67e5\u8be2\u6267\u884c\u8ba1\u5212\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>18. \u8bef\u533a\uff1a\u6ca1\u6709\u5904\u7406\u6570\u636e\u5e93\u7684\u5e76\u53d1\u95ee\u9898<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u591a\u7528\u6237\u5e76\u53d1\u73af\u5883\u4e0b\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u5ffd\u7565\u4e86\u5e76\u53d1\u64cd\u4f5c\u7684\u51b2\u7a81\u95ee\u9898\uff0c\u5bfc\u81f4\u810f\u8bfb\u3001\u4e0d\u53ef\u91cd\u590d\u8bfb\u3001\u5e7b\u8bfb\u7b49\u95ee\u9898\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528\u5408\u9002\u7684\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\uff08\u5982 <code>REPEATABLE READ<\/code> \u6216 <code>SERIALIZABLE<\/code>\uff09\u6765\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n\n\n\n<li>\u901a\u8fc7\u4e50\u89c2\u9501\u548c\u60b2\u89c2\u9501\u673a\u5236\u6765\u5904\u7406\u5e76\u53d1\u95ee\u9898\u3002<\/li>\n\n\n\n<li>\u5728\u8fdb\u884c\u66f4\u65b0\u64cd\u4f5c\u65f6\uff0c\u4f7f\u7528\u6761\u4ef6\u5224\u65ad\u907f\u514d\u5e76\u53d1\u51b2\u7a81\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u4f7f\u7528\u60b2\u89c2\u9501\nSELECT * FROM products WHERE id = 1 FOR UPDATE;\n\n-- \u4f7f\u7528\u4e50\u89c2\u9501\nUPDATE products SET stock = stock - 1 WHERE id = 1 AND stock &gt; 0;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>19. \u8bef\u533a\uff1a\u9519\u8bef\u7684\u65f6\u95f4\u6233\u6216\u65e5\u671f\u683c\u5f0f<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u95ee\u9898\uff1a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5904\u7406\u65f6\u95f4\u6233\u6216\u65e5\u671f\u65f6\uff0c\u4e0d\u540c\u7684\u6570\u636e\u5e93\u7cfb\u7edf\u53ef\u80fd\u6709\u4e0d\u540c\u7684\u65f6\u95f4\u683c\u5f0f\uff0c\u5bfc\u81f4\u65e5\u671f\u8ba1\u7b97\u9519\u8bef\u6216\u8de8\u65f6\u533a\u95ee\u9898\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u5982\u4f55\u907f\u514d\uff1a<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u6807\u51c6\u65f6\u95f4\u6233\u7c7b\u578b\uff08\u5982 <code>TIMESTAMP<\/code> \u6216 <code>DATETIME<\/code>\uff09\u3002<\/li>\n\n\n\n<li>\u5728\u63d2\u5165\u6216\u66f4\u65b0\u6570\u636e\u65f6\uff0c\u786e\u4fdd\u65e5\u671f\u683c\u5f0f\u7684\u4e00\u81f4\u6027\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u65f6\u533a\u95ee\u9898\uff0c\u4f7f\u7528UTC\u65f6\u95f4\u5b58\u50a8\uff0c\u5e76\u5728\u663e\u793a\u65f6\u8f6c\u6362\u4e3a\u672c\u5730\u65f6\u95f4\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SQL\u7684\u8bef\u533a\u591a\u79cd\u591a\u6837\uff0c\u968f\u7740\u5f00\u53d1\u7ecf\u9a8c\u7684\u79ef\u7d2f\uff0c\u4f60\u4f1a\u9010\u6e10\u53d1\u73b0\u5e76\u907f\u514d\u8fd9\u4e9b\u5e38\u89c1\u9519\u8bef\u3002\u6b63\u786e\u7684SQL\u7f16\u5199\u4e60\u60ef\u4e0d\u4ec5\u80fd\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u8fd8\u80fd\u4fdd\u8bc1\u7cfb\u7edf\u7684\u9ad8\u6548\u3001\u7a33\u5b9a\u548c\u5b89\u5168\u3002\u638c\u63e1SQL\u7684\u9ad8\u7ea7\u6280\u5de7\u548c\u4f18\u5316\u7b56\u7565\uff0c\u907f\u514d\u8fd9\u4e9b\u8bef\u533a\uff0c\u662f\u6bcf\u4e2a\u5f00\u53d1\u8005\u5fc5\u987b\u8981\u5b66\u4f1a\u7684\u6280\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528SQL\u65f6\uff0c\u5f00\u53d1\u8005\u5e38\u5e38\u4f1a\u72af\u4e00\u4e9b\u8bef\u533a\uff0c\u8fd9\u4e9b\u8bef\u533a\u53ef\u80fd\u5bfc\u81f4\u6027\u80fd\u4f4e\u4e0b\u3001\u6570\u636e\u4e0d\u4e00\u81f4\u6216\u8005\u51fa\u73b0\u9519\u8bef\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684SQ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-1526","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1526"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1526\/revisions"}],"predecessor-version":[{"id":1527,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1526\/revisions\/1527"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}