{"id":104843,"date":"2026-09-13T09:57:07","date_gmt":"2026-09-13T01:57:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/104843.html"},"modified":"2026-09-13T09:57:07","modified_gmt":"2026-09-13T01:57:07","slug":"%e5%b9%b2%e8%b4%a7%e6%95%b4%e5%90%88mysql%e5%87%bd%e6%95%b0%e5%85%a8%e6%94%bb%e7%95%a5%ef%bc%9a%e4%bb%8e%e5%85%a5%e9%97%a8%e5%88%b0%e7%b2%be%e9%80%9a","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/104843.html","title":{"rendered":"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E7%9A%84%E2%80%9C%E8%AE%A1%E7%AE%97%E5%99%A8%E2%80%9D-toc\" style=\"margin-left:80px\">\u4e00\u3001\u6570\u503c\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u8ba1\u7b97\u5668\u201d<\/p>\n<p id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88-toc\" style=\"margin-left:120px\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/p>\n<p id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E8%AE%A1%E7%AE%97%E9%94%80%E9%87%8F%E5%8D%A0%E6%AF%94-toc\" style=\"margin-left:120px\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u9500\u91cf\u5360\u6bd4<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%87%BD%E6%95%B0%EF%BC%9A%E6%96%87%E6%9C%AC%E7%9A%84%E2%80%9C%E7%BE%8E%E5%AE%B9%E5%B8%88%E2%80%9D-toc\" style=\"margin-left:80px\">\u4e8c\u3001\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u6587\u672c\u7684\u201c\u7f8e\u5bb9\u5e08\u201d<\/p>\n<p id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88-toc\" style=\"margin-left:120px\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/p>\n<p id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E4%BF%AE%E5%A4%8D%E7%94%A8%E6%88%B7%E5%90%8D%E5%AD%97%E6%A0%BC%E5%BC%8F-toc\" style=\"margin-left:120px\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u4fee\u590d\u7528\u6237\u540d\u5b57\u683c\u5f0f<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F%E5%87%BD%E6%95%B0%EF%BC%9A%E6%97%B6%E9%97%B4%E7%9A%84%E2%80%9C%E7%A9%BF%E6%A2%AD%E6%9C%BA%E2%80%9D-toc\" style=\"margin-left:80px\">\u4e09\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570&#xff1a;\u65f6\u95f4\u7684\u201c\u7a7f\u68ad\u673a\u201d<\/p>\n<p id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88-toc\" style=\"margin-left:120px\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/p>\n<p id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E8%AE%A1%E7%AE%97%E7%94%A8%E6%88%B7%E6%9C%80%E5%90%8E%E7%99%BB%E5%BD%95%E6%97%B6%E9%97%B4-toc\" style=\"margin-left:120px\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u7528\u6237\u6700\u540e\u767b\u5f55\u65f6\u95f4<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E7%9A%84%E2%80%9C%E8%A3%81%E5%88%A4%E5%91%98%E2%80%9D-toc\" style=\"margin-left:80px\">\u56db\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u88c1\u5224\u5458\u201d<\/p>\n<p id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88-toc\" style=\"margin-left:120px\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/p>\n<p id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E5%AD%A6%E7%94%9F%E6%88%90%E7%BB%A9%E5%88%86%E7%BA%A7-toc\" style=\"margin-left:120px\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u5b66\u751f\u6210\u7ee9\u5206\u7ea7<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E5%BC%80%E7%AA%97%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E7%9A%84%E2%80%9C%E9%80%8F%E8%A7%86%E7%9C%BC%E2%80%9D%EF%BC%88%E8%BF%9B%E9%98%B6%E5%BF%85%E8%AF%BB%EF%BC%89-toc\" style=\"margin-left:80px\">\u4e94\u3001\u5f00\u7a97\u51fd\u6570&#xff1a;\u6570\u636e\u5206\u6790\u7684\u201c\u900f\u89c6\u773c\u201d&#xff08;\u8fdb\u9636\u5fc5\u8bfb&#xff09;<\/p>\n<p id=\"1.%20%E8%AF%AD%E6%B3%95%E7%BB%93%E6%9E%84-toc\" style=\"margin-left:120px\">1. \u8bed\u6cd5\u7ed3\u6784<\/p>\n<p id=\"2.%20%E5%AE%9E%E6%88%98%E5%9C%BA%E6%99%AF%20A%EF%BC%9A%E7%BB%84%E5%86%85%E6%8E%92%E5%90%8D%EF%BC%88RANK%20vs%20ROW_NUMBER%EF%BC%89-toc\" style=\"margin-left:120px\">2. \u5b9e\u6218\u573a\u666f A&#xff1a;\u7ec4\u5185\u6392\u540d&#xff08;RANK vs ROW_NUMBER&#xff09;<\/p>\n<p id=\"3.%20%E5%AE%9E%E6%88%98%E5%9C%BA%E6%99%AF%20B%EF%BC%9A%E9%94%99%E4%BD%8D%E8%AE%A1%E7%AE%97%EF%BC%88LAG%2FLEAD%EF%BC%89-toc\" style=\"margin-left:120px\">3. \u5b9e\u6218\u573a\u666f B&#xff1a;\u9519\u4f4d\u8ba1\u7b97&#xff08;LAG\/LEAD&#xff09;<\/p>\n<p id=\"%E6%80%BB%E7%BB%93-toc\" style=\"margin-left:80px\">\u603b\u7ed3<\/p>\n<hr id=\"hr-toc\" \/>\n<p>\u5728 SQL \u7684\u4e16\u754c\u91cc&#xff0c;\u51fd\u6570\u5c31\u50cf\u662f\u6570\u636e\u5206\u6790\u5e08\u7684\u201c\u9b54\u6cd5\u5de5\u5177\u7bb1\u201d\u3002\u65e0\u8bba\u662f\u5904\u7406\u6742\u4e71\u7684\u6587\u672c\u3001\u8ba1\u7b97\u590d\u6742\u7684\u8d22\u52a1\u6570\u636e&#xff0c;\u8fd8\u662f\u8fdb\u884c\u9ad8\u7ea7\u7684\u6392\u540d\u5206\u6790&#xff0c;\u90fd\u79bb\u4e0d\u5f00\u8fd9\u4e9b\u5f3a\u5927\u7684\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n<p>\u5f88\u591a\u521d\u5b66\u8005\u9762\u5bf9\u00a0ROUND\u3001SUBSTR\u3001OVER\u00a0\u8fd9\u4e9b\u5173\u952e\u8bcd\u65f6&#xff0c;\u5e38\u5e38\u611f\u5230\u5934\u5927\u3002\u522b\u62c5\u5fc3&#xff0c;\u672c\u6587\u4e0d\u8bb2\u67af\u71e5\u7684\u5b9a\u4e49&#xff0c;\u6211\u4eec\u5c06\u628a\u8fd9\u4e9b\u51fd\u6570\u60f3\u8c61\u6210\u4e00\u4e2a\u4e2a\u5b9e\u7528\u7684\u5de5\u5177&#xff0c;\u5e26\u4f60\u5f7b\u5e95\u641e\u61c2 MySQL \u4e2d\u7684\u56db\u5927\u7c7b\u6838\u5fc3\u51fd\u6570&#xff1a;\u6570\u503c\u51fd\u6570\u3001\u5b57\u7b26\u4e32\u51fd\u6570\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff0c;\u5e76\u91cd\u70b9\u653b\u514b SQL \u4e2d\u6700\u5f3a\u5927\u7684\u5f00\u7a97\u51fd\u6570\u3002<\/p>\n<hr \/>\n<h4 id=\"%E4%B8%80%E3%80%81%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E7%9A%84%E2%80%9C%E8%AE%A1%E7%AE%97%E5%99%A8%E2%80%9D\" style=\"background-color:transparent\">\u4e00\u3001\u6570\u503c\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u8ba1\u7b97\u5668\u201d<\/h4>\n<p>\u6570\u503c\u51fd\u6570\u4e3b\u8981\u7528\u4e8e\u5904\u7406\u6570\u5b57&#xff0c;\u6bd4\u5982\u7b97\u8d26\u3001\u53d6\u6574\u3001\u7b97\u6982\u7387\u7b49\u3002<\/p>\n<h5 id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/h5>\n<ul>\n<li>\u56db\u820d\u4e94\u5165\u4e0e\u683c\u5f0f\u5316&#xff1a;\n<ul>\n<li>ROUND(X, n)&#xff1a;\u6807\u51c6\u7684\u56db\u820d\u4e94\u5165&#xff0c;\u4fdd\u7559 n \u4f4d\u5c0f\u6570\u3002<\/li>\n<li>FORMAT(X, n)&#xff1a;\u4e0d\u4ec5\u56db\u820d\u4e94\u5165&#xff0c;\u8fd8\u4f1a\u52a0\u4e0a\u5343\u5206\u4f4d\u5206\u9694\u7b26&#xff08;\u5982\u00a01,234.00&#xff09;&#xff0c;\u9002\u5408\u5c55\u793a\u91d1\u989d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u53d6\u6574&#xff1a;\n<ul>\n<li>FLOOR(x)&#xff1a;\u5730\u677f\u51fd\u6570&#xff0c;\u5411\u4e0b\u53d6\u6574&#xff08;\u6bd4\u5982 1.9 \u53d8\u6210 1&#xff09;\u3002<\/li>\n<li>CEIL(x)&#xff1a;\u5929\u82b1\u677f\u51fd\u6570&#xff0c;\u5411\u4e0a\u53d6\u6574&#xff08;\u6bd4\u5982 1.1 \u53d8\u6210 2&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5176\u4ed6\u8fd0\u7b97&#xff1a;\n<ul>\n<li>MOD(X, Y)&#xff1a;\u6c42\u4f59\u6570&#xff08;\u5e38\u7528\u4e8e\u5224\u65ad\u5947\u5076\u6570&#xff09;\u3002<\/li>\n<li>POW(X, Y)&#xff1a;\u6c42 X \u7684 Y \u6b21\u65b9\u3002<\/li>\n<li>RAND()&#xff1a;\u751f\u6210 0 \u5230 1 \u4e4b\u95f4\u7684\u968f\u673a\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5 id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E8%AE%A1%E7%AE%97%E9%94%80%E9%87%8F%E5%8D%A0%E6%AF%94\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u9500\u91cf\u5360\u6bd4<\/h5>\n<p>\u573a\u666f&#xff1a;\u6709\u4e00\u5f20\u00a0tb_sales\u00a0\u8868&#xff0c;\u8bb0\u5f55\u4e86\u6bcf\u4e2a\u6708\u7684\u9500\u91cf\u3002\u73b0\u5728\u8981\u7b97\u51fa\u6bcf\u4e2a\u6708\u9500\u91cf\u5360\u603b\u9500\u91cf\u7684\u767e\u5206\u6bd4&#xff0c;\u5e76\u4fdd\u7559 2 \u4f4d\u5c0f\u6570\u3002<\/p>\n<p>&#8212; \u9700\u6c42&#xff1a;\u8ba1\u7b97\u6bcf\u4e2a\u6708\u7684\u9500\u91cf\u5360\u5168\u5e74\u603b\u9500\u91cf\u7684\u767e\u5206\u6bd4<br \/>\nSELECT<br \/>\n    month,<br \/>\n    sales,<br \/>\n    &#8212; \u6838\u5fc3\u903b\u8f91&#xff1a;\u5f53\u524d\u9500\u91cf \/ (\u5b50\u67e5\u8be2\u7b97\u51fa\u7684\u603b\u9500\u91cf) * 100&#xff0c;\u7136\u540e\u56db\u820d\u4e94\u5165<br \/>\n    ROUND(sales \/ (SELECT SUM(sales) FROM tb_sales) * 100, 2) AS &#039;\u5360\u6bd4(%)&#039;<br \/>\nFROM tb_sales; <\/p>\n<h4 id=\"%E4%BA%8C%E3%80%81%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%87%BD%E6%95%B0%EF%BC%9A%E6%96%87%E6%9C%AC%E7%9A%84%E2%80%9C%E7%BE%8E%E5%AE%B9%E5%B8%88%E2%80%9D\">\u4e8c\u3001\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u6587\u672c\u7684\u201c\u7f8e\u5bb9\u5e08\u201d<\/h4>\n<p>\u5904\u7406\u7528\u6237\u540d\u3001\u5730\u5740\u3001\u63cf\u8ff0\u7b49\u6587\u672c\u4fe1\u606f\u65f6&#xff0c;\u8fd9\u4e9b\u51fd\u6570\u5fc5\u4e0d\u53ef\u5c11\u3002<\/p>\n<h5 id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/h5>\n<ul>\n<li>\u5927\u5c0f\u5199\u8f6c\u6362&#xff1a;LOWER()\u00a0\u8f6c\u5c0f\u5199&#xff0c;UPPER()\u00a0\u8f6c\u5927\u5199\u3002<\/li>\n<li>\u62fc\u63a5\u4e0e\u66ff\u6362&#xff1a;\n<ul>\n<li>CONCAT(str1, str2)&#xff1a;\u628a\u4e24\u4e2a\u5b57\u7b26\u4e32\u8fde\u8d77\u6765\u3002<\/li>\n<li>REPLACE(str, old, new)&#xff1a;\u628a\u5b57\u7b26\u4e32\u91cc\u7684\u65e7\u5185\u5bb9\u66ff\u6362\u6210\u65b0\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u622a\u53d6\u4e0e\u957f\u5ea6&#xff1a;\n<ul>\n<li>SUBSTR(str, n, m)&#xff1a;\u4ece\u7b2c n \u4f4d\u5f00\u59cb\u622a\u53d6 m \u4e2a\u5b57\u7b26\u3002<\/li>\n<li>CHAR_LENGTH&#xff1a;\u5b57\u7b26\u4e2a\u6570&#xff08;\u4e2d\u6587\u7b971\u4e2a&#xff09;\u3002<\/li>\n<li>LENGTH&#xff1a;\u5b58\u50a8\u5b57\u8282\u957f\u5ea6&#xff08;UTF8\u7f16\u7801\u4e0b\u4e2d\u6587\u901a\u5e38\u7b973\u4e2a\u5b57\u8282&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5 id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E4%BF%AE%E5%A4%8D%E7%94%A8%E6%88%B7%E5%90%8D%E5%AD%97%E6%A0%BC%E5%BC%8F\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u4fee\u590d\u7528\u6237\u540d\u5b57\u683c\u5f0f<\/h5>\n<p>\u573a\u666f&#xff1a;users\u00a0\u8868\u91cc\u7684\u540d\u5b57\u683c\u5f0f\u6df7\u4e71&#xff0c;\u6709\u7684\u5168\u5927\u5199&#xff0c;\u6709\u7684\u5168\u5c0f\u5199\u3002\u6211\u4eec\u8981\u628a\u5b83\u4fee\u590d\u6210\u201c\u9996\u5b57\u6bcd\u5927\u5199&#xff0c;\u5176\u4f59\u5c0f\u5199\u201d\u7684\u6807\u51c6\u683c\u5f0f\u3002<\/p>\n<p>&#8212; \u9700\u6c42&#xff1a;\u5c06 &#039;aLice&#039; \u4fee\u590d\u4e3a &#039;Alice&#039;<br \/>\nSELECT<br \/>\n    user_id,<br \/>\n    &#8212; \u903b\u8f91&#xff1a;\u53d6\u7b2c1\u4e2a\u5b57\u6bcd\u8f6c\u5927\u5199 &#043; \u53d6\u7b2c2\u4e2a\u5b57\u6bcd\u5230\u6700\u540e\u7684\u5b57\u6bcd\u8f6c\u5c0f\u5199 &#043; \u62fc\u63a5\u8d77\u6765<br \/>\n    CONCAT(UPPER(LEFT(name, 1)), LOWER(SUBSTR(name, 2))) AS &#039;\u4fee\u590d\u540e\u7684\u540d\u5b57&#039;<br \/>\nFROM users; <\/p>\n<h4 id=\"%E4%B8%89%E3%80%81%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F%E5%87%BD%E6%95%B0%EF%BC%9A%E6%97%B6%E9%97%B4%E7%9A%84%E2%80%9C%E7%A9%BF%E6%A2%AD%E6%9C%BA%E2%80%9D\">\u4e09\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570&#xff1a;\u65f6\u95f4\u7684\u201c\u7a7f\u68ad\u673a\u201d<\/h4>\n<p>\u5904\u7406\u8ba2\u5355\u65f6\u95f4\u3001\u767b\u5f55\u65e5\u5fd7\u3001\u5e74\u9f84\u8ba1\u7b97\u7b49\u3002<\/p>\n<h5 id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/h5>\n<ul>\n<li>\u83b7\u53d6\u5f53\u524d\u65f6\u95f4&#xff1a;NOW()\u00a0(\u5e74\u6708\u65e5\u65f6\u5206\u79d2),\u00a0CURRENT_DATE()\u00a0(\u4ec5\u65e5\u671f)\u3002<\/li>\n<li>\u65f6\u95f4\u8ba1\u7b97&#xff1a;\n<ul>\n<li>DATE_ADD(date, INTERVAL x unit)&#xff1a;\u5728\u67d0\u4e2a\u65f6\u95f4\u4e0a\u52a0\u4e00\u6bb5\u65f6\u95f4\u3002<\/li>\n<li>DATEDIFF(date1, date2)&#xff1a;\u8ba1\u7b97\u4e24\u4e2a\u65e5\u671f\u76f8\u5dee\u591a\u5c11\u5929\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u63d0\u53d6\u90e8\u5206&#xff1a;YEAR(),\u00a0MONTH(),\u00a0DAY(),\u00a0HOUR()\u00a0\u7b49\u3002<\/li>\n<li>\u683c\u5f0f\u5316&#xff1a;DATE_FORMAT(date, &#039;%Y-%m-%d&#039;)\u00a0\u628a\u65f6\u95f4\u53d8\u6210\u6307\u5b9a\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<h5 id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E8%AE%A1%E7%AE%97%E7%94%A8%E6%88%B7%E6%9C%80%E5%90%8E%E7%99%BB%E5%BD%95%E6%97%B6%E9%97%B4\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u7528\u6237\u6700\u540e\u767b\u5f55\u65f6\u95f4<\/h5>\n<p>\u573a\u666f&#xff1a;\u67e5\u8be2\u00a0logins\u00a0\u8868&#xff0c;\u627e\u51fa\u00a02020\u5e74\u00a0\u767b\u5f55\u8fc7\u7684\u7528\u6237&#xff0c;\u5e76\u663e\u793a\u4ed6\u4eec\u5f53\u5e74\u7684\u6700\u540e\u4e00\u6b21\u767b\u5f55\u65f6\u95f4\u3002<\/p>\n<p>&#8212; \u9700\u6c42&#xff1a;\u67e5\u8be22020\u5e74\u6bcf\u4e2a\u7528\u6237\u7684\u6700\u540e\u4e00\u6b21\u767b\u5f55\u65f6\u95f4<br \/>\nSELECT<br \/>\n    user_id,<br \/>\n    MAX(time_stamp) AS last_time<br \/>\nFROM<br \/>\n    logins<br \/>\nWHERE<br \/>\n    YEAR(time_stamp) &#061; 2020  &#8212; \u63d0\u53d6\u5e74\u4efd\u8fdb\u884c\u7b5b\u9009<br \/>\nGROUP BY<br \/>\n    user_id; <\/p>\n<h4 id=\"%E5%9B%9B%E3%80%81%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E7%9A%84%E2%80%9C%E8%A3%81%E5%88%A4%E5%91%98%E2%80%9D\">\u56db\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u88c1\u5224\u5458\u201d<\/h4>\n<p>\u6839\u636e\u6761\u4ef6\u5224\u65ad\u6765\u8fd4\u56de\u4e0d\u540c\u7684\u503c&#xff0c;\u5e38\u7528\u4e8e\u6570\u636e\u5206\u7c7b\u6216\u903b\u8f91\u5904\u7406\u3002<\/p>\n<h5 id=\"1.%20%E6%A0%B8%E5%BF%83%E5%8A%9F%E8%83%BD%E9%80%9F%E8%A7%88\">1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<\/h5>\n<ul>\n<li>IF(\u6761\u4ef6, \u503c1, \u503c2)&#xff1a;\u7c7b\u4f3c\u4e8e Excel \u7684 IF \u51fd\u6570&#xff0c;\u6761\u4ef6\u6210\u7acb\u8fd4\u56de\u503c1&#xff0c;\u5426\u5219\u8fd4\u56de\u503c2\u3002<\/li>\n<li>CASE WHEN&#xff1a;\u7c7b\u4f3c\u4e8e Java \u7684 Switch \u6216\u591a\u91cd If-Else&#xff0c;\u9002\u5408\u590d\u6742\u7684\u6761\u4ef6\u5224\u65ad\u3002<\/li>\n<\/ul>\n<h5 id=\"2.%20%E5%AE%9E%E6%88%98%E6%A1%88%E4%BE%8B%EF%BC%9A%E5%AD%A6%E7%94%9F%E6%88%90%E7%BB%A9%E5%88%86%E7%BA%A7\">2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u5b66\u751f\u6210\u7ee9\u5206\u7ea7<\/h5>\n<p>\u573a\u666f&#xff1a;\u67e5\u8be2\u00a0tb_score\u00a0\u8868&#xff0c;\u5c06\u5206\u6570\u5212\u5206\u4e3a\u201c\u4f18\u79c0\u3001\u826f\u597d\u3001\u53ca\u683c\u3001\u4e0d\u53ca\u683c\u201d\u56db\u4e2a\u7b49\u7ea7\u3002<\/p>\n<p>&#8212; \u9700\u6c42&#xff1a;\u6839\u636e\u5206\u6570\u663e\u793a\u7b49\u7ea7<br \/>\nSELECT<br \/>\n    name,<br \/>\n    score,<br \/>\n    CASE<br \/>\n        WHEN score &gt;&#061; 90 THEN &#039;\u4f18\u79c0&#039;<br \/>\n        WHEN score &gt;&#061; 80 THEN &#039;\u826f\u597d&#039;<br \/>\n        WHEN score &gt;&#061; 60 THEN &#039;\u53ca\u683c&#039;<br \/>\n        ELSE &#039;\u4e0d\u53ca\u683c&#039;<br \/>\n    END AS grade<br \/>\nFROM tb_score; <\/p>\n<h4 id=\"%E4%BA%94%E3%80%81%E5%BC%80%E7%AA%97%E5%87%BD%E6%95%B0%EF%BC%9A%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E7%9A%84%E2%80%9C%E9%80%8F%E8%A7%86%E7%9C%BC%E2%80%9D%EF%BC%88%E8%BF%9B%E9%98%B6%E5%BF%85%E8%AF%BB%EF%BC%89\">\u4e94\u3001\u5f00\u7a97\u51fd\u6570&#xff1a;\u6570\u636e\u5206\u6790\u7684\u201c\u900f\u89c6\u773c\u201d&#xff08;\u8fdb\u9636\u5fc5\u8bfb&#xff09;<\/h4>\n<p>\u5f00\u7a97\u51fd\u6570&#xff08;Window Function&#xff09;\u662f MySQL 8.0 \u5f15\u5165\u7684\u91cd\u78c5\u529f\u80fd&#xff0c;\u4e5f\u662f SQL \u4e2d\u6700\u96be\u7406\u89e3\u4f46\u6700\u5f3a\u5927\u7684\u90e8\u5206\u3002<\/p>\n<p>\u6838\u5fc3\u533a\u522b&#xff1a;<\/p>\n<ul>\n<li>\u666e\u901a\u805a\u5408&#xff08;GROUP BY&#xff09;&#xff1a;\u628a\u4e00\u5806\u6570\u636e\u63c9\u6210\u4e00\u4e2a\u7403&#xff08;\u591a\u884c\u53d8\u4e00\u884c&#xff09;&#xff0c;\u4f60\u4f1a\u4e22\u5931\u660e\u7ec6\u6570\u636e\u3002<\/li>\n<li>\u5f00\u7a97\u51fd\u6570&#xff08;OVER&#xff09;&#xff1a;\u7ed9\u6bcf\u4e00\u884c\u6570\u636e\u88c5\u4e0a\u4e00\u53cc\u201c\u900f\u89c6\u773c\u201d&#xff0c;\u8ba9\u5b83\u80fd\u770b\u5230\u5468\u56f4\u7684\u6570\u636e&#xff0c;\u4f46\u81ea\u5df1\u8fd8\u662f\u81ea\u5df1&#xff08;\u591a\u884c\u53d8\u591a\u884c&#xff09;\u3002<\/li>\n<\/ul>\n<h5 id=\"1.%20%E8%AF%AD%E6%B3%95%E7%BB%93%E6%9E%84\">1. \u8bed\u6cd5\u7ed3\u6784<\/h5>\n<p>\u51fd\u6570\u540d() OVER ( [PARTITION BY \u5206\u7ec4\u5217] [ORDER BY \u6392\u5e8f\u5217] ) <\/p>\n<ul>\n<li>PARTITION BY&#xff1a;\u76f8\u5f53\u4e8e\u201c\u5206\u7ec4\u201d&#xff0c;\u628a\u5927\u961f\u4f0d\u62c6\u6210\u5c0f\u961f\u3002<\/li>\n<li>ORDER BY&#xff1a;\u76f8\u5f53\u4e8e\u201c\u6392\u5e8f\u201d&#xff0c;\u89c4\u5b9a\u961f\u4f0d\u6309\u4ec0\u4e48\u987a\u5e8f\u6392\u3002<\/li>\n<\/ul>\n<h5 id=\"2.%20%E5%AE%9E%E6%88%98%E5%9C%BA%E6%99%AF%20A%EF%BC%9A%E7%BB%84%E5%86%85%E6%8E%92%E5%90%8D%EF%BC%88RANK%20vs%20ROW_NUMBER%EF%BC%89\">2. \u5b9e\u6218\u573a\u666f A&#xff1a;\u7ec4\u5185\u6392\u540d&#xff08;RANK vs ROW_NUMBER&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u67e5\u8be2\u6bcf\u4e2a\u79d1\u76ee\u7684\u6210\u7ee9\u6392\u540d\u3002<\/p>\n<ul>\n<li>ROW_NUMBER()&#xff1a;\u5f3a\u884c\u6392\u540d&#xff08;1, 2, 3&#xff09;&#xff0c;\u54ea\u6015\u5206\u6570\u4e00\u6837\u4e5f\u8981\u5206\u5148\u540e\u3002<\/li>\n<li>RANK()&#xff1a;\u5e76\u5217\u8df3\u8dc3&#xff08;1, 1, 3&#xff09;&#xff0c;\u4e24\u4e2a\u4eba\u7b2c\u4e00&#xff0c;\u4e0b\u4e00\u4e2a\u5c31\u662f\u7b2c\u4e09\u3002<\/li>\n<li>DENSE_RANK()&#xff1a;\u5e76\u5217\u4e0d\u8df3\u8dc3&#xff08;1, 1, 2&#xff09;&#xff0c;\u4e24\u4e2a\u4eba\u7b2c\u4e00&#xff0c;\u4e0b\u4e00\u4e2a\u662f\u7b2c\u4e8c\u3002 &#8212; \u9700\u6c42&#xff1a;\u6309\u79d1\u76ee\u5206\u7ec4&#xff0c;\u6309\u5206\u6570\u964d\u5e8f\u6392\u540d<br \/>\nSELECT<br \/>\n    name,<br \/>\n    course,<br \/>\n    score,<br \/>\n    DENSE_RANK() OVER (PARTITION BY course ORDER BY score DESC) as ranking<br \/>\nFROM tb_score; <\/p>\n<h5 id=\"3.%20%E5%AE%9E%E6%88%98%E5%9C%BA%E6%99%AF%20B%EF%BC%9A%E9%94%99%E4%BD%8D%E8%AE%A1%E7%AE%97%EF%BC%88LAG%2FLEAD%EF%BC%89\">3. \u5b9e\u6218\u573a\u666f B&#xff1a;\u9519\u4f4d\u8ba1\u7b97&#xff08;LAG\/LEAD&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u8ba1\u7b97\u6bcf\u4e2a\u6708\u9500\u91cf\u4e0e\u4e0a\u4e2a\u6708\u7684\u5dee\u503c&#xff08;\u73af\u6bd4\u5206\u6790&#xff09;\u3002LAG\u00a0\u53ef\u4ee5\u8ba9\u4f60\u201c\u56de\u5934\u770b\u201d\u4e0a\u4e00\u884c\u7684\u6570\u636e\u3002<\/p>\n<p> &#8212; \u9700\u6c42&#xff1a;\u8ba1\u7b97\u5f53\u6708\u9500\u91cf\u4e0e\u4e0a\u6708\u9500\u91cf\u7684\u5dee\u503c<br \/>\nSELECT<br \/>\n    month,<br \/>\n    sales,<br \/>\n    LAG(sales) OVER (ORDER BY month) AS pre_sales, &#8212; \u83b7\u53d6\u4e0a\u4e00\u884c\u7684\u9500\u91cf<br \/>\n    sales &#8211; LAG(sales) OVER (ORDER BY month) AS diff &#8212; \u5f53\u524d\u51cf\u53bb\u4e0a\u4e00\u884c<br \/>\nFROM tb_sales; <\/p>\n<h4 id=\"%E6%80%BB%E7%BB%93\">\u603b\u7ed3<\/h4>\n<p>\u638c\u63e1\u8fd9\u4e9b\u51fd\u6570&#xff0c;\u4f60\u7684 SQL \u80fd\u529b\u5c06\u5b8c\u6210\u4ece\u201c\u67e5\u6570\u636e\u201d\u5230\u201c\u5206\u6790\u6570\u636e\u201d\u7684\u8d28\u53d8&#xff1a;<\/p>\n<\/li>\n<li>\u6570\u503c\u51fd\u6570&#xff1a;\u641e\u5b9a\u8ba1\u7b97\u548c\u7cbe\u5ea6\u3002<\/li>\n<li>\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u641e\u5b9a\u6e05\u6d17\u548c\u62fc\u63a5\u3002<\/li>\n<li>\u65f6\u95f4\u51fd\u6570&#xff1a;\u641e\u5b9a\u65e5\u5fd7\u548c\u5468\u671f\u5206\u6790\u3002<\/li>\n<li>\u6d41\u7a0b\u63a7\u5236&#xff1a;\u641e\u5b9a\u4e1a\u52a1\u903b\u8f91\u5206\u7c7b\u3002<\/li>\n<li>\u5f00\u7a97\u51fd\u6570&#xff1a;\u641e\u5b9a\u590d\u6742\u7684\u6392\u540d\u3001\u5360\u6bd4\u548c\u540c\u6bd4\u73af\u6bd4\u5206\u6790\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n\u4e00\u3001\u6570\u503c\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u8ba1\u7b97\u5668\u201d<br \/>\n1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<br \/>\n2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u9500\u91cf\u5360\u6bd4<br \/>\n\u4e8c\u3001\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u6587\u672c\u7684\u201c\u7f8e\u5bb9\u5e08\u201d<br \/>\n1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<br \/>\n2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u4fee\u590d\u7528\u6237\u540d\u5b57\u683c\u5f0f<br \/>\n\u4e09\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570&#xff1a;\u65f6\u95f4\u7684\u201c\u7a7f\u68ad\u673a\u201d<br \/>\n1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<br \/>\n2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u7528\u6237\u6700\u540e\u767b\u5f55\u65f6\u95f4<br \/>\n\u56db\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u88c1\u5224\u5458\u201d<br \/>\n1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8<br \/>\n2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u5b66<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11653,114,768,100],"topic":[],"class_list":["post-104843","post","type-post","status-publish","format-standard","hentry","category-server","tag-11653","tag-mysql","tag-sql","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\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.wsisp.com\/helps\/104843.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u4e00\u3001\u6570\u503c\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u8ba1\u7b97\u5668\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u9500\u91cf\u5360\u6bd4 \u4e8c\u3001\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u6587\u672c\u7684\u201c\u7f8e\u5bb9\u5e08\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u4fee\u590d\u7528\u6237\u540d\u5b57\u683c\u5f0f \u4e09\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570&#xff1a;\u65f6\u95f4\u7684\u201c\u7a7f\u68ad\u673a\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u7528\u6237\u6700\u540e\u767b\u5f55\u65f6\u95f4 \u56db\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u88c1\u5224\u5458\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u5b66\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/104843.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-13T01:57:07+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104843.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/104843.html\",\"name\":\"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-13T01:57:07+00:00\",\"dateModified\":\"2026-09-13T01:57:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/104843.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/104843.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104843.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/104843.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u4e00\u3001\u6570\u503c\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u8ba1\u7b97\u5668\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u9500\u91cf\u5360\u6bd4 \u4e8c\u3001\u5b57\u7b26\u4e32\u51fd\u6570&#xff1a;\u6587\u672c\u7684\u201c\u7f8e\u5bb9\u5e08\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u4fee\u590d\u7528\u6237\u540d\u5b57\u683c\u5f0f \u4e09\u3001\u65f6\u95f4\u65e5\u671f\u51fd\u6570&#xff1a;\u65f6\u95f4\u7684\u201c\u7a7f\u68ad\u673a\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u8ba1\u7b97\u7528\u6237\u6700\u540e\u767b\u5f55\u65f6\u95f4 \u56db\u3001\u6d41\u7a0b\u63a7\u5236\u51fd\u6570&#xff1a;\u6570\u636e\u7684\u201c\u88c1\u5224\u5458\u201d 1. \u6838\u5fc3\u529f\u80fd\u901f\u89c8 2. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u5b66","og_url":"https:\/\/www.wsisp.com\/helps\/104843.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-13T01:57:07+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/104843.html","url":"https:\/\/www.wsisp.com\/helps\/104843.html","name":"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-13T01:57:07+00:00","dateModified":"2026-09-13T01:57:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/104843.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/104843.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/104843.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5e72\u8d27\u6574\u5408,MySQL\u51fd\u6570\u5168\u653b\u7565\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=104843"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104843\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=104843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=104843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=104843"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=104843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}