{"id":38215,"date":"2025-05-20T01:04:24","date_gmt":"2025-05-19T17:04:24","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/38215.html"},"modified":"2025-05-20T01:04:24","modified_gmt":"2025-05-19T17:04:24","slug":"sql%e7%bb%8f%e5%85%b8%e5%ae%9e%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/38215.html","title":{"rendered":"SQL\u7ecf\u5178\u5b9e\u4f8b"},"content":{"rendered":"<h4>\u7b2c1\u7ae0 \u68c0\u7d22\u8bb0\u5f55<\/h4>\n<ul>\n<li>1.1 \u68c0\u7d22\u6240\u6709\u884c\u548c\u5217\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528SELECT *\u5feb\u901f\u68c0\u7d22\u8868\u4e2d\u6240\u6709\u5217&#xff1b;\u663e\u5f0f\u5217\u51fa\u5217\u540d&#xff08;\u5982SELECT col1, col2&#xff09;\u63d0\u9ad8\u53ef\u8bfb\u6027\u548c\u53ef\u63a7\u6027&#xff0c;\u5c24\u5176\u5728\u7f16\u7a0b\u573a\u666f\u4e2d\u66f4\u6e05\u6670\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.2 \u7b5b\u9009\u884c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7WHERE\u5b50\u53e5\u8fc7\u6ee4\u7b26\u5408\u6761\u4ef6\u7684\u884c&#xff0c;\u652f\u6301\u5e38\u7528\u8fd0\u7b97\u7b26&#xff08;&#061;\u3001&lt;\u3001&gt;\u7b49&#xff09;&#xff0c;\u662f\u6570\u636e\u7b5b\u9009\u7684\u57fa\u7840\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.3 \u67e5\u627e\u6ee1\u8db3\u591a\u4e2a\u67e5\u8be2\u6761\u4ef6\u7684\u884c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528AND\u3001OR\u548c\u62ec\u53f7\u7ec4\u5408\u591a\u4e2a\u6761\u4ef6&#xff0c;\u6ce8\u610f\u903b\u8f91\u4f18\u5148\u7ea7&#xff0c;\u786e\u4fdd\u6761\u4ef6\u6b63\u786e\u5206\u7ec4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.4 \u7b5b\u9009\u5217\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5728SELECT\u4e2d\u6307\u5b9a\u5177\u4f53\u5217&#xff0c;\u907f\u514d\u8fd4\u56de\u65e0\u5173\u6570\u636e&#xff0c;\u63d0\u5347\u67e5\u8be2\u6548\u7387&#xff0c;\u5c24\u5176\u5728\u7f51\u7edc\u4f20\u8f93\u6570\u636e\u65f6\u91cd\u8981\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.5 \u521b\u5efa\u6709\u610f\u4e49\u7684\u5217\u540d\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7AS\u5173\u952e\u5b57\u4e3a\u5217\u8bbe\u7f6e\u522b\u540d&#xff08;\u5982SELECT sal AS salary&#xff09;&#xff0c;\u589e\u5f3a\u7ed3\u679c\u53ef\u8bfb\u6027&#xff0c;\u522b\u540d\u53ef\u7528\u4e8e\u540e\u7eed\u5f15\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.6 \u5728WHERE\u5b50\u53e5\u4e2d\u5f15\u7528\u522b\u540d\u5217\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;WHERE\u5b50\u53e5\u65e0\u6cd5\u76f4\u63a5\u5f15\u7528SELECT\u4e2d\u7684\u522b\u540d&#xff0c;\u9700\u901a\u8fc7\u5185\u5d4c\u89c6\u56fe&#xff08;\u5b50\u67e5\u8be2&#xff09;\u5305\u88c5\u67e5\u8be2&#xff0c;\u4f7f\u5916\u5c42\u67e5\u8be2\u53ef\u8bbf\u95ee\u522b\u540d\u5217\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.7 \u4e32\u8054\u591a\u5217\u7684\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4e0d\u540c\u6570\u636e\u5e93\u4f7f\u7528\u4e0d\u540c\u4e32\u8054\u65b9\u6cd5&#xff0c;\u5982DB2\/Oracle\/PostgreSQL\u7528||&#xff0c;MySQL\u7528CONCAT&#xff0c;SQL Server\u7528&#043;&#xff0c;\u5b9e\u73b0\u591a\u5217\u5408\u5e76\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.8 \u5728SELECT\u8bed\u53e5\u91cc\u4f7f\u7528\u6761\u4ef6\u903b\u8f91\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7CASE\u8868\u8fbe\u5f0f\u5b9e\u73b0\u6761\u4ef6\u903b\u8f91&#xff08;\u5982\u6839\u636e\u5de5\u8d44\u8303\u56f4\u8fd4\u56de\u72b6\u6001&#xff09;&#xff0c;\u66ff\u4ee3\u4f20\u7edf\u7f16\u7a0b\u8bed\u8a00\u7684IF-ELSE&#xff0c;\u589e\u5f3a\u67e5\u8be2\u7075\u6d3b\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.9 \u9650\u5b9a\u8fd4\u56de\u884c\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4e0d\u540c\u6570\u636e\u5e93\u9650\u5236\u884c\u6570\u7684\u8bed\u6cd5\u4e0d\u540c&#xff0c;\u5982MySQL\/PostgreSQL\u7528LIMIT&#xff0c;Oracle\u7528ROWNUM&#xff0c;SQL Server\u7528TOP&#xff0c;DB2\u7528FETCH FIRST&#xff0c;\u7528\u4e8e\u5206\u9875\u6216\u9650\u5236\u7ed3\u679c\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.10 \u968f\u673a\u8fd4\u56de\u82e5\u5e72\u884c\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u7ed3\u5408ORDER BY\u4e0e\u968f\u673a\u51fd\u6570&#xff08;\u5982RAND()\u3001DBMS_RANDOM.VALUE()&#xff09;\u5b9e\u73b0\u968f\u673a\u6392\u5e8f&#xff0c;\u518d\u7528\u884c\u6570\u9650\u5236\u8bed\u6cd5\u83b7\u53d6\u968f\u673a\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.11 \u67e5\u627eNull\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528IS NULL\u5224\u65adNull\u503c&#xff0c;\u4e0d\u80fd\u7528&#061;\u6216!&#061;&#xff0c;\u662f\u5904\u7406\u7f3a\u5931\u6570\u636e\u7684\u57fa\u7840\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.12 \u628aNull\u503c\u8f6c\u6362\u4e3a\u5b9e\u9645\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7COALESCE\u51fd\u6570&#xff08;\u5982COALESCE(comm, 0)&#xff09;\u5c06Null\u66ff\u6362\u4e3a\u6307\u5b9a\u503c&#xff0c;\u6216\u7528CASE\u8868\u8fbe\u5f0f\u5b9e\u73b0\u7c7b\u4f3c\u903b\u8f91&#xff0c;\u786e\u4fdd\u8ba1\u7b97\u6b63\u786e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>1.13 \u67e5\u627e\u5339\u914d\u9879\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528LIKE\u914d\u5408\u901a\u914d\u7b26%&#xff08;\u5339\u914d\u4efb\u610f\u5b57\u7b26&#xff09;\u548c_&#xff08;\u5339\u914d\u5355\u4e2a\u5b57\u7b26&#xff09;\u8fdb\u884c\u6a21\u5f0f\u5339\u914d&#xff0c;\u7b5b\u9009\u7b26\u5408\u7279\u5b9a\u5b57\u7b26\u4e32\u6a21\u5f0f\u7684\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c2\u7ae0 \u67e5\u8be2\u7ed3\u679c\u6392\u5e8f<\/h4>\n<ul>\n<li>2.1 \u4ee5\u6307\u5b9a\u987a\u5e8f\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7ORDER BY\u5b50\u53e5\u6392\u5e8f&#xff0c;\u9ed8\u8ba4\u5347\u5e8f&#xff08;ASC&#xff09;&#xff0c;\u964d\u5e8f\u7528DESC&#xff0c;\u53ef\u6309\u5217\u540d\u6216\u5217\u4f4d\u7f6e\u5e8f\u53f7\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>2.2 \u591a\u5b57\u6bb5\u6392\u5e8f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5728ORDER BY\u4e2d\u7528\u9017\u53f7\u5206\u9694\u591a\u4e2a\u5b57\u6bb5&#xff0c;\u6309\u987a\u5e8f\u4f9d\u6b21\u6392\u5e8f&#xff0c;\u652f\u6301\u4e0d\u540c\u5b57\u6bb5\u4e0d\u540c\u6392\u5e8f\u65b9\u5411\u3002<\/li>\n<\/ul>\n<\/li>\n<li>2.3 \u4f9d\u636e\u5b50\u4e32\u6392\u5e8f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528\u5b57\u7b26\u4e32\u51fd\u6570&#xff08;\u5982SUBSTR\u3001SUBSTRING&#xff09;\u63d0\u53d6\u5b50\u4e32&#xff0c;\u6309\u5b50\u4e32\u5185\u5bb9\u6392\u5e8f&#xff0c;\u4f8b\u5982\u6309\u804c\u4f4d\u6700\u540e\u4e24\u4e2a\u5b57\u7b26\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>2.4 \u5bf9\u542b\u6709\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u5217\u6392\u5e8f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7TRANSLATE\u548cREPLACE\u51fd\u6570\u6e05\u7406\u975e\u76ee\u6807\u5b57\u7b26&#xff0c;\u4fdd\u7559\u5b57\u6bcd\u6216\u6570\u5b57\u90e8\u5206&#xff0c;\u518d\u8fdb\u884c\u6392\u5e8f&#xff0c;\u5904\u7406\u6df7\u5408\u6570\u636e\u5217\u3002<\/li>\n<\/ul>\n<\/li>\n<li>2.5 \u6392\u5e8f\u65f6\u5bf9Null\u503c\u7684\u5904\u7406\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;Oracle\u652f\u6301NULLS FIRST\/LAST\u76f4\u63a5\u63a7\u5236Null\u503c\u4f4d\u7f6e&#xff0c;\u5176\u4ed6\u6570\u636e\u5e93\u901a\u8fc7CASE\u8868\u8fbe\u5f0f\u6807\u8bb0Null\u503c&#xff0c;\u8c03\u6574\u5176\u5728\u6392\u5e8f\u4e2d\u7684\u987a\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>2.6 \u4f9d\u636e\u6761\u4ef6\u903b\u8f91\u52a8\u6001\u8c03\u6574\u6392\u5e8f\u9879\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5728ORDER BY\u4e2d\u4f7f\u7528CASE\u8868\u8fbe\u5f0f&#xff0c;\u6839\u636e\u6761\u4ef6\u52a8\u6001\u9009\u62e9\u6392\u5e8f\u5b57\u6bb5&#xff0c;\u4f8b\u5982\u6309\u804c\u4f4d\u7c7b\u578b\u5207\u6362\u6392\u5e8f\u4f9d\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c3\u7ae0 \u591a\u8868\u67e5\u8be2<\/h4>\n<ul>\n<li>3.1 \u53e0\u52a0\u4e24\u4e2a\u884c\u96c6\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528UNION ALL\u5408\u5e76\u591a\u4e2a\u8868\u7684\u884c&#xff08;\u5305\u542b\u91cd\u590d&#xff09;&#xff0c;UNION\u53bb\u91cd&#xff0c;\u8981\u6c42\u5217\u6570\u548c\u6570\u636e\u7c7b\u578b\u5339\u914d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.2 \u5408\u5e76\u76f8\u5173\u884c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u5185\u8fde\u63a5&#xff08;INNER JOIN\u6216\u9690\u5f0f\u8fde\u63a5&#xff09;\u57fa\u4e8e\u5171\u540c\u5217\u5408\u5e76\u8868&#xff0c;\u8fd4\u56de\u5339\u914d\u884c&#xff0c;\u662f\u591a\u8868\u6570\u636e\u5173\u8054\u7684\u57fa\u7840\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.3 \u67e5\u627e\u4e24\u4e2a\u8868\u4e2d\u76f8\u540c\u7684\u884c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528INTERSECT&#xff08;DB2\/PostgreSQL\/Oracle&#xff09;\u6216\u8fde\u63a5\u67e5\u8be2\u5339\u914d\u591a\u5217&#xff0c;\u83b7\u53d6\u4e24\u8868\u4ea4\u96c6\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.4 \u67e5\u627e\u53ea\u5b58\u5728\u4e8e\u4e00\u4e2a\u8868\u4e2d\u7684\u6570\u636e\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5dee\u96c6\u8fd0\u7b97&#xff08;DB2\/PostgreSQL\u7528EXCEPT&#xff0c;Oracle\u7528MINUS&#xff09;\u6216NOT IN\u3001NOT EXISTS\u5b50\u67e5\u8be2&#xff0c;\u627e\u51fa\u5355\u8868\u72ec\u6709\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.5 \u4ece\u4e00\u4e2a\u8868\u68c0\u7d22\u4e0e\u53e6\u4e00\u4e2a\u8868\u4e0d\u76f8\u5173\u7684\u884c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5916\u8fde\u63a5&#xff08;\u5de6\/\u53f3\/\u5168\u8fde\u63a5&#xff09;\u4fdd\u7559\u4e3b\u8868\u4e0d\u5339\u914d\u884c&#xff0c;\u8fc7\u6ee4Null\u503c\u540e\u83b7\u53d6\u65e0\u5173\u8054\u6570\u636e&#xff0c;\u5982\u67e5\u627e\u65e0\u5458\u5de5\u7684\u90e8\u95e8\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.6 \u65b0\u589e\u8fde\u63a5\u67e5\u8be2\u800c\u4e0d\u5f71\u54cd\u5176\u4ed6\u8fde\u63a5\u67e5\u8be2\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528\u5916\u8fde\u63a5&#xff08;\u5982LEFT JOIN&#xff09;\u907f\u514d\u4e22\u5931\u4e3b\u8868\u6570\u636e&#xff0c;\u6216\u6807\u91cf\u5b50\u67e5\u8be2\u6dfb\u52a0\u989d\u5916\u4fe1\u606f&#xff0c;\u786e\u4fdd\u539f\u6709\u7ed3\u679c\u96c6\u5b8c\u6574\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.7 \u786e\u5b9a\u4e24\u4e2a\u8868\u662f\u5426\u6709\u76f8\u540c\u7684\u6570\u636e\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u5dee\u96c6\u8fd0\u7b97\u7ed3\u5408UNION ALL\u6bd4\u8f83\u4e24\u8868\u5dee\u5f02&#xff0c;\u6216\u5148\u6bd4\u8f83\u884c\u6570\u518d\u9010\u884c\u5bf9\u6bd4&#xff0c;\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.8 \u8bc6\u522b\u5e76\u6d88\u9664\u7b1b\u5361\u513f\u79ef\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u7b1b\u5361\u513f\u79ef\u7531\u7f3a\u5c11\u8fde\u63a5\u6761\u4ef6\u5bfc\u81f4&#xff0c;\u901a\u8fc7n-1\u4e2a\u8fde\u63a5\u6761\u4ef6&#xff08;WHERE\u6216JOIN&#xff09;\u907f\u514d&#xff0c;\u786e\u4fdd\u7ed3\u679c\u6b63\u786e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.9 \u7ec4\u5408\u4f7f\u7528\u8fde\u63a5\u67e5\u8be2\u4e0e\u805a\u5408\u51fd\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u805a\u5408\u524d\u6ce8\u610f\u8fde\u63a5\u53ef\u80fd\u4ea7\u751f\u7684\u91cd\u590d\u884c&#xff0c;\u7528DISTINCT\u53bb\u91cd\u6216\u5148\u805a\u5408\u518d\u8fde\u63a5&#xff0c;\u786e\u4fdd\u7edf\u8ba1\u7ed3\u679c\u51c6\u786e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.10 \u7ec4\u5408\u4f7f\u7528\u5916\u8fde\u63a5\u67e5\u8be2\u4e0e\u805a\u5408\u51fd\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5916\u8fde\u63a5\u4fdd\u7559\u4e3b\u8868\u6570\u636e&#xff0c;\u805a\u5408\u65f6\u5904\u7406Null\u503c&#xff08;\u5982COALESCE&#xff09;&#xff0c;\u6b63\u786e\u8ba1\u7b97\u5305\u542b\u7f3a\u5931\u5173\u8054\u6570\u636e\u7684\u5206\u7ec4\u7edf\u8ba1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.11 \u4ece\u591a\u4e2a\u8868\u4e2d\u8fd4\u56de\u7f3a\u5931\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5168\u5916\u8fde\u63a5&#xff08;FULL OUTER JOIN&#xff09;\u7ed3\u5408\u6761\u4ef6\u8fc7\u6ee4&#xff0c;\u540c\u65f6\u4fdd\u7559\u4e24\u8868\u4e0d\u5339\u914d\u884c&#xff0c;\u5982\u540c\u65f6\u663e\u793a\u65e0\u5458\u5de5\u7684\u90e8\u95e8\u548c\u65e0\u90e8\u95e8\u7684\u5458\u5de5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>3.12 \u5728\u8fd0\u7b97\u548c\u6bd4\u8f83\u4e2d\u4f7f\u7528Null\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;COALESCE\u5c06Null\u8f6c\u6362\u4e3a\u6709\u6548\u503c\u53c2\u4e0e\u8fd0\u7b97&#xff0c;\u907f\u514dNull\u5bfc\u81f4\u7684\u903b\u8f91\u9519\u8bef&#xff0c;\u786e\u4fdd\u6bd4\u8f83\u548c\u8ba1\u7b97\u6b63\u786e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c4\u7ae0 \u63d2\u5165\u3001\u66f4\u65b0\u548c\u5220\u9664<\/h4>\n<ul>\n<li>4.1 \u63d2\u5165\u65b0\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4f7f\u7528INSERT INTO &#8230; VALUES\u63d2\u5165\u5355\u884c\u6216\u591a\u884c&#xff0c;\u7701\u7565\u5217\u540d\u65f6\u9700\u6309\u987a\u5e8f\u63d0\u4f9b\u6240\u6709\u5217\u503c&#xff0c;\u652f\u6301\u6279\u91cf\u63d2\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.2 \u63d2\u5165\u9ed8\u8ba4\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7DEFAULT\u5173\u952e\u5b57\u663e\u5f0f\u63d2\u5165\u5217\u9ed8\u8ba4\u503c&#xff0c;\u6216\u7701\u7565\u5217\u540d\u5229\u7528\u8868\u5b9a\u4e49\u7684\u9ed8\u8ba4\u503c&#xff0c;\u7b80\u5316\u63d2\u5165\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.3 \u4f7f\u7528Null\u8986\u76d6\u9ed8\u8ba4\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5728VALUES\u4e2d\u663e\u5f0f\u6307\u5b9aNULL&#xff0c;\u5373\u4f7f\u5217\u6709\u9ed8\u8ba4\u503c\u4e5f\u5f3a\u5236\u63d2\u5165Null&#xff0c;\u63a7\u5236\u6570\u636e\u8f93\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.4 \u590d\u5236\u6570\u636e\u5230\u53e6\u4e00\u4e2a\u8868\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;INSERT INTO &#8230; SELECT\u5c06\u67e5\u8be2\u7ed3\u679c\u63d2\u5165\u76ee\u6807\u8868&#xff0c;\u652f\u6301\u8fc7\u6ee4\u6761\u4ef6&#xff0c;\u5feb\u901f\u8fc1\u79fb\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.5 \u590d\u5236\u8868\u5b9a\u4e49\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;DB2\u7528CREATE TABLE &#8230; LIKE&#xff0c;\u5176\u4ed6\u6570\u636e\u5e93\u7528SELECT * FROM &#8230; WHERE 1&#061;0\u521b\u5efa\u7a7a\u8868&#xff0c;\u590d\u5236\u8868\u7ed3\u6784\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.6 \u591a\u8868\u63d2\u5165\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;Oracle\u7528INSERT ALL\u6839\u636e\u6761\u4ef6\u63d2\u5165\u591a\u8868&#xff0c;DB2\u901a\u8fc7UNION ALL\u7ed3\u5408\u8868\u7ea6\u675f\u5b9e\u73b0&#xff0c;\u5176\u4ed6\u6570\u636e\u5e93\u9700\u5206\u6b65\u63d2\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.7 \u7981\u6b62\u63d2\u5165\u7279\u5b9a\u5217\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u521b\u5efa\u4ec5\u66b4\u9732\u5141\u8bb8\u63d2\u5165\u5217\u7684\u89c6\u56fe&#xff0c;\u9650\u5236\u7528\u6237\u64cd\u4f5c&#xff0c;\u901a\u8fc7\u89c6\u56fe\u6743\u9650\u63a7\u5236\u6570\u636e\u63d2\u5165\u8303\u56f4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.8 \u66f4\u65b0\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;UPDATE &#8230; SET\u7ed3\u5408WHERE\u66f4\u65b0\u6307\u5b9a\u884c&#xff0c;\u652f\u6301\u8868\u8fbe\u5f0f\u8ba1\u7b97&#xff08;\u5982\u52a0\u85aa10%&#xff09;&#xff0c;\u9884\u89c8\u7ed3\u679c\u540e\u6267\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.9 \u5f53\u76f8\u5173\u884c\u5b58\u5728\u65f6\u66f4\u65b0\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5b50\u67e5\u8be2IN\u6216EXISTS\u5224\u65ad\u5173\u8054\u8868\u5b58\u5728\u6027&#xff0c;\u9488\u5bf9\u6027\u66f4\u65b0&#xff0c;\u5982\u6839\u636e\u5956\u91d1\u8868\u66f4\u65b0\u5de5\u8d44\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.10 \u4f7f\u7528\u53e6\u4e00\u4e2a\u8868\u7684\u6570\u636e\u66f4\u65b0\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u8fde\u63a5\u4e24\u8868\u540e\u66f4\u65b0&#xff08;\u5982UPDATE &#8230; FROM &#8230; JOIN&#xff09;&#xff0c;\u6216\u5b50\u67e5\u8be2\u63d0\u4f9b\u65b0\u503c&#xff0c;\u5b9e\u73b0\u8de8\u8868\u6570\u636e\u540c\u6b65\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.11 \u5408\u5e76\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;Oracle\u7684MERGE\u8bed\u53e5\u6839\u636e\u5339\u914d\u6761\u4ef6\u81ea\u52a8\u63d2\u5165\u6216\u66f4\u65b0&#xff0c;\u7b80\u5316\u6570\u636e\u540c\u6b65\u903b\u8f91&#xff0c;\u5176\u4ed6\u6570\u636e\u5e93\u9700\u5206\u6b65\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.12 \u5220\u9664\u5168\u8868\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;DELETE FROM\u4e0d\u5e26WHERE\u5220\u9664\u6240\u6709\u884c&#xff0c;\u6ce8\u610f\u4e8b\u52a1\u548c\u6027\u80fd\u5f71\u54cd&#xff0c;\u5927\u8868\u614e\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.13 \u5220\u9664\u6307\u5b9a\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;DELETE &#8230; WHERE\u7ed3\u5408\u6761\u4ef6\u8fc7\u6ee4&#xff0c;\u786e\u4fdd\u7cbe\u786e\u5220\u9664&#xff0c;\u907f\u514d\u8bef\u5220\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.14 \u5220\u9664\u5355\u884c\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u57fa\u4e8e\u4e3b\u952e\u6216\u552f\u4e00\u952e\u7cbe\u786e\u5220\u9664&#xff0c;\u786e\u4fddWHERE\u6761\u4ef6\u552f\u4e00&#xff0c;\u907f\u514d\u5220\u9664\u591a\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.15 \u5220\u9664\u8fdd\u53cd\u53c2\u7167\u5b8c\u6574\u6027\u7684\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;NOT EXISTS\u6216NOT IN\u5b50\u67e5\u8be2\u627e\u51fa\u65e0\u5173\u8054\u7684\u5b64\u7acb\u8bb0\u5f55&#xff0c;\u5982\u5220\u9664\u65e0\u5bf9\u5e94\u90e8\u95e8\u7684\u5458\u5de5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.16 \u5220\u9664\u91cd\u590d\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u6309\u91cd\u590d\u5217\u5206\u7ec4&#xff0c;\u4fdd\u7559\u6700\u5c0f\/\u6700\u5927\u6807\u8bc6\u7684\u884c&#xff0c;\u5220\u9664\u5176\u4ed6\u91cd\u590d\u884c&#xff0c;\u786e\u4fdd\u6570\u636e\u552f\u4e00\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<li>4.17 \u5220\u9664\u88ab\u5176\u4ed6\u8868\u53c2\u7167\u7684\u8bb0\u5f55\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5148\u5904\u7406\u5b50\u8868\u4f9d\u8d56\u6570\u636e&#xff08;\u5982\u7ea7\u8054\u5220\u9664&#xff09;&#xff0c;\u6216\u76f4\u63a5\u5220\u9664\u4e3b\u8868\u8bb0\u5f55&#xff08;\u9700\u6570\u636e\u5e93\u652f\u6301\u5916\u952e\u7ea7\u8054&#xff09;&#xff0c;\u5904\u7406\u5916\u952e\u7ea6\u675f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c5\u7ae0 \u5143\u6570\u636e\u67e5\u8be2<\/h4>\n<ul>\n<li>5.1 \u5217\u4e3e\u6a21\u5f0f\u4e2d\u7684\u8868\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u67e5\u8be2\u7cfb\u7edf\u8868\u6216\u89c6\u56fe&#xff08;\u5982DB2\u7684SYSCAT.TABLES&#xff0c;Oracle\u7684ALL_TABLES&#xff0c;\u4fe1\u606f\u6a21\u5f0fINFORMATION_SCHEMA.TABLES&#xff09;\u83b7\u53d6\u8868\u5217\u8868\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.2 \u5217\u4e3e\u5b57\u6bb5\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u7cfb\u7edf\u89c6\u56fe\u83b7\u53d6\u5217\u4fe1\u606f&#xff08;\u5982\u6570\u636e\u7c7b\u578b\u3001\u4f4d\u7f6e&#xff09;&#xff0c;\u5982DB2\u7684SYSCAT.COLUMNS&#xff0c;Oracle\u7684ALL_TAB_COLUMNS\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.3 \u5217\u4e3e\u7d22\u5f15\u5217\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u67e5\u8be2\u7d22\u5f15\u76f8\u5173\u7cfb\u7edf\u8868&#xff08;\u5982DB2\u7684SYSCAT.INDEXES&#xff0c;Oracle\u7684ALL_IND_COLUMNS&#xff09;&#xff0c;\u4e86\u89e3\u8868\u7684\u7d22\u5f15\u7ed3\u6784\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.4 \u5217\u4e3e\u7ea6\u675f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u7cfb\u7edf\u89c6\u56fe\u83b7\u53d6\u7ea6\u675f\u4fe1\u606f&#xff08;\u4e3b\u952e\u3001\u5916\u952e\u3001\u68c0\u67e5\u7ea6\u675f\u7b49&#xff09;&#xff0c;\u5982SYSCAT.TABCONST&#xff08;DB2&#xff09;\u3001ALL_CONSTRAINTS&#xff08;Oracle&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.5 \u5217\u4e3e\u975e\u7d22\u5f15\u5916\u952e\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u7ed3\u5408\u7d22\u5f15\u548c\u5916\u952e\u7cfb\u7edf\u8868&#xff0c;\u7b5b\u9009\u672a\u5efa\u7acb\u7d22\u5f15\u7684\u5916\u952e\u5217&#xff0c;\u4f18\u5316\u6570\u636e\u5e93\u6027\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.6 \u7528SQL\u751f\u6210SQL\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u5b57\u7b26\u4e32\u62fc\u63a5\u52a8\u6001\u751f\u6210SQL\u811a\u672c&#xff08;\u5982\u7edf\u8ba1\u884c\u6570\u3001\u7981\u7528\u7ea6\u675f&#xff09;&#xff0c;\u5b9e\u73b0\u81ea\u52a8\u5316\u7ef4\u62a4\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>5.7 \u63cf\u8ff0Oracle\u6570\u636e\u5b57\u5178\u89c6\u56fe\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5229\u7528Oracle\u7684DICTIONARY\u548cDICT_COLUMNS\u89c6\u56fe&#xff0c;\u5feb\u901f\u4e86\u89e3\u6570\u636e\u5b57\u5178\u89c6\u56fe\u7684\u7ed3\u6784\u548c\u7528\u9014\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c6\u7ae0 \u5b57\u7b26\u4e32\u5904\u7406<\/h4>\n<ul>\n<li>6.1 \u904d\u5386\u5b57\u7b26\u4e32\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7\u7b1b\u5361\u513f\u79ef\u751f\u6210\u591a\u884c&#xff0c;\u7528SUBSTR\u9010\u5b57\u7b26\u63d0\u53d6&#xff0c;\u6a21\u62df\u5faa\u73af\u5904\u7406\u5b57\u7b26\u4e32&#xff0c;\u662f\u5b57\u7b26\u4e32\u89e3\u6790\u7684\u57fa\u7840\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.2 \u5d4c\u5165\u5f15\u53f7\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5728\u5b57\u7b26\u4e32\u4e2d\u7528\u4e24\u4e2a\u8fde\u7eed\u5f15\u53f7\u8868\u793a\u5355\u4e2a\u5f15\u53f7&#xff08;\u5982&#039;&#039;&#xff09;&#xff0c;\u5904\u7406\u5305\u542b\u5f15\u53f7\u7684\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.3 \u7edf\u8ba1\u5b57\u7b26\u51fa\u73b0\u7684\u6b21\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7LENGTH\u548cREPLACE\u8ba1\u7b97\u539f\u5b57\u7b26\u4e32\u4e0e\u66ff\u6362\u540e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u5dee&#xff0c;\u9664\u4ee5\u76ee\u6807\u5b57\u7b26\u957f\u5ea6&#xff0c;\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.4 \u5220\u9664\u4e0d\u60f3\u8981\u7684\u5b57\u7b26\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;TRANSLATE\u66ff\u6362\u76ee\u6807\u5b57\u7b26\u4e3a\u7edf\u4e00\u7b26\u53f7&#xff0c;\u518d\u7528REPLACE\u5220\u9664&#xff0c;\u6216\u591a\u6b21REPLACE\u9010\u4e2a\u5220\u9664\u6307\u5b9a\u5b57\u7b26\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.5 \u5206\u79bb\u6570\u5b57\u548c\u5b57\u7b26\u6570\u636e\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;TRANSLATE\u5c06\u6570\u5b57\u6216\u5b57\u7b26\u8f6c\u6362\u4e3a\u7edf\u4e00\u7b26\u53f7&#xff0c;REPLACE\u5220\u9664\u975e\u76ee\u6807\u7b26\u53f7&#xff0c;\u5206\u79bb\u6df7\u5408\u6570\u636e\u5217\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.6 \u5224\u65ad\u542b\u6709\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u5b57\u7b26\u4e32\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;TRANSLATE\u5c06\u5b57\u6bcd\u6570\u5b57\u8f6c\u6362\u4e3a\u5355\u4e00\u5b57\u7b26&#xff0c;\u6bd4\u8f83\u8f6c\u6362\u540e\u5b57\u7b26\u4e32\u662f\u5426\u5168\u7531\u8be5\u5b57\u7b26\u7ec4\u6210&#xff0c;\u6216\u7528\u6b63\u5219\u8868\u8fbe\u5f0f&#xff08;\u5982MySQL\u7684REGEXP&#xff09;\u7b5b\u9009\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.7 \u63d0\u53d6\u59d3\u540d\u7684\u9996\u5b57\u6bcd\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u901a\u8fc7TRANSLATE\u3001REPLACE\u5904\u7406\u975e\u5b57\u6bcd\u5b57\u7b26&#xff0c;\u63d0\u53d6\u9996\u5b57\u6bcd\u5e76\u62fc\u63a5&#xff0c;\u5904\u7406\u4e0d\u540c\u683c\u5f0f\u7684\u59d3\u540d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.8 \u6309\u7167\u5b50\u5b57\u7b26\u4e32\u6392\u5e8f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u7528SUBSTR\u63d0\u53d6\u5b50\u4e32&#xff0c;\u5728ORDER BY\u4e2d\u6309\u5b50\u4e32\u6392\u5e8f&#xff0c;\u5982\u6309\u59d3\u540d\u6700\u540e\u4e24\u4e2a\u5b57\u7b26\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.9 \u6839\u636e\u5b57\u7b26\u4e32\u91cc\u7684\u6570\u5b57\u6392\u5e8f\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u6e05\u7406\u975e\u6570\u5b57\u5b57\u7b26&#xff08;\u5982TRANSLATE\u66ff\u6362\u4e3a\u6570\u5b57&#xff09;&#xff0c;\u8f6c\u6362\u4e3a\u6570\u503c\u7c7b\u578b\u540e\u6392\u5e8f&#xff0c;\u5904\u7406\u6df7\u5408\u6570\u5b57\u7684\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.10 \u521b\u5efa\u5206\u9694\u5217\u8868\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u4e0d\u540c\u6570\u636e\u5e93\u7528\u4e0d\u540c\u65b9\u6cd5&#xff0c;\u5982MySQL\u7684GROUP_CONCAT&#xff0c;Oracle\u7684SYS_CONNECT_BY_PATH&#xff0c;\u62fc\u63a5\u591a\u884c\u6570\u636e\u4e3a\u9017\u53f7\u5206\u9694\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.11 \u5206\u9694\u6570\u636e\u8f6c\u6362\u4e3a\u591a\u503cIN\u5217\u8868\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u62c6\u5206\u5206\u9694\u5b57\u7b26\u4e32\u4e3a\u591a\u884c&#xff0c;\u8f6c\u6362\u4e3a\u6570\u503c\u540e\u7528\u4e8eIN\u5b50\u53e5&#xff0c;\u5904\u7406\u8f93\u5165\u7684\u5217\u8868\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.12 \u6309\u5b57\u6bcd\u8868\u987a\u5e8f\u6392\u5217\u5b57\u7b26\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u904d\u5386\u5b57\u7b26\u5e76\u6392\u5e8f&#xff0c;\u7528\u805a\u5408\u51fd\u6570\u62fc\u63a5&#xff0c;\u5b9e\u73b0\u5b57\u7b26\u4e32\u5185\u5b57\u7b26\u7684\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.13 \u8bc6\u522b\u5b57\u7b26\u4e32\u91cc\u7684\u6570\u5b57\u5b57\u7b26\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;TRANSLATE\u6807\u8bb0\u6570\u5b57\u5b57\u7b26&#xff0c;\u7b5b\u9009\u5305\u542b\u6570\u5b57\u7684\u884c&#xff0c;\u6216\u63d0\u53d6\u7eaf\u6570\u5b57\u90e8\u5206&#xff0c;\u5904\u7406\u6df7\u5408\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.14 \u63d0\u53d6\u7b2cn\u4e2a\u5206\u9694\u5b50\u5b57\u7b26\u4e32\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5229\u7528SUBSTRING_INDEX&#xff08;MySQL&#xff09;\u3001SPLIT_PART&#xff08;PostgreSQL&#xff09;\u6216INSTR\u7ed3\u5408SUBSTR&#xff0c;\u6309\u5206\u9694\u7b26\u63d0\u53d6\u6307\u5b9a\u4f4d\u7f6e\u5b50\u4e32\u3002<\/li>\n<\/ul>\n<\/li>\n<li>6.15 \u89e3\u6790IP\u5730\u5740\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u6309.\u5206\u9694\u7b26\u62c6\u5206IP\u5730\u5740\u4e3a\u56db\u90e8\u5206&#xff0c;\u7528\u5b57\u7b26\u4e32\u51fd\u6570\u63d0\u53d6\u5404\u6bb5\u6570\u503c&#xff0c;\u5904\u7406\u7f51\u7edc\u5730\u5740\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u7b2c7\u7ae0 \u6570\u503c\u5904\u7406<\/h4>\n<ul>\n<li>7.1 \u8ba1\u7b97\u5e73\u5747\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;AVG\u51fd\u6570\u5ffd\u7565Null\u503c&#xff0c;\u5206\u7ec4\u8ba1\u7b97&#xff08;GROUP BY&#xff09;\u5404\u90e8\u95e8\u5e73\u5747\u503c&#xff0c;\u5904\u7406\u805a\u5408\u7edf\u8ba1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.2 \u67e5\u627e\u6700\u5c0f\u503c\u548c\u6700\u5927\u503c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;MIN\u548cMAX\u51fd\u6570\u83b7\u53d6\u5217\u6781\u503c&#xff0c;\u652f\u6301\u5206\u7ec4\u7edf\u8ba1&#xff0c;\u5ffd\u7565Null\u503c&#xff0c;\u662f\u57fa\u672c\u805a\u5408\u51fd\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.3 \u6c42\u548c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;SUM\u51fd\u6570\u7d2f\u52a0\u6570\u503c\u5217&#xff0c;\u652f\u6301\u5206\u7ec4&#xff08;GROUP BY&#xff09;&#xff0c;\u5ffd\u7565Null\u503c&#xff0c;\u5904\u7406\u6570\u636e\u6c47\u603b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.4 \u8ba1\u7b97\u884c\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;COUNT(*)\u7edf\u8ba1\u6240\u6709\u884c&#xff0c;COUNT(col)\u7edf\u8ba1\u975eNull\u503c\u884c\u6570&#xff0c;\u5206\u7ec4\u7edf\u8ba1\u5404\u90e8\u95e8\u4eba\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.5 \u8ba1\u7b97\u975eNull\u503c\u7684\u4e2a\u6570\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;COUNT(col)\u81ea\u52a8\u5ffd\u7565Null&#xff0c;\u76f4\u63a5\u83b7\u53d6\u6709\u6548\u6570\u636e\u884c\u6570&#xff0c;\u5982\u7edf\u8ba1\u6709\u5956\u91d1\u7684\u5458\u5de5\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.6 \u7d2f\u8ba1\u6c42\u548c\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u7a97\u53e3\u51fd\u6570SUM OVER&#xff08;DB2\/Oracle&#xff09;\u6216\u6807\u91cf\u5b50\u67e5\u8be2&#xff08;\u5176\u4ed6\u6570\u636e\u5e93&#xff09;&#xff0c;\u6309\u987a\u5e8f\u7d2f\u52a0\u503c&#xff0c;\u751f\u6210\u8fd0\u884c\u603b\u8ba1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>7.7 \u8ba1\u7b97\u7d2f\u8ba1\u4e58\u79ef\n<ul>\n<li>\u77e5\u8bc6\u70b9&#xff1a;\u5229\u7528\u5bf9\u6570\u8f6c\u6362\u548c\u6307\u6570\u8fd0\u7b97&#xff08;LN&#043;EXP&#xff09;\u5b9e\u73b0\u7d2f\u8ba1\u4e58\u79ef&#xff0c;\u6216Oracle\u7684MODEL\u5b50\u53e5&#xff0c;\u5904\u7406\u6570\u503c\u8fde\u4e58\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u540e\u7eed\u7ae0\u8282&#xff08;8-14\u7ae0\u53ca\u9644\u5f55&#xff09;<\/h4>\n<ul>\n<li>\u7b2c8-14\u7ae0&#xff1a;\u6db5\u76d6\u65e5\u671f\u8fd0\u7b97\u3001\u65e5\u671f\u5904\u7406\u3001\u533a\u95f4\u67e5\u8be2\u3001\u9ad8\u7ea7\u67e5\u8be2\u3001\u62a5\u8868\u751f\u6210\u3001\u5c42\u6b21\u67e5\u8be2\u7b49&#xff0c;\u6d89\u53ca\u7a97\u53e3\u51fd\u6570\u3001\u9012\u5f52\u67e5\u8be2\u3001\u6570\u636e\u900f\u89c6\u7b49\u9ad8\u7ea7\u6280\u672f&#xff0c;\u9488\u5bf9\u4e0d\u540c\u6570\u636e\u5e93\u7684\u7279\u6027\u63d0\u4f9b\u89e3\u51b3\u65b9\u6848\u3002<\/li>\n<li>\u9644\u5f55A&#xff1a;\u7a97\u53e3\u51fd\u6570\u7b80\u4ecb&#xff0c;\u89e3\u91ca\u5206\u7ec4\u3001\u805a\u5408\u3001\u5206\u533a\u7b49\u6982\u5ff5&#xff0c;\u662f\u7406\u89e3\u9ad8\u7ea7\u67e5\u8be2\u7684\u57fa\u7840\u3002<\/li>\n<li>\u9644\u5f55B&#xff1a;\u91cd\u6e29\u7ecf\u5178SQL\u95ee\u9898&#xff0c;\u7ed3\u5408\u65b0\u7279\u6027&#xff08;\u5982\u7a97\u53e3\u51fd\u6570&#xff09;\u63d0\u4f9b\u4f18\u5316\u65b9\u6848&#xff0c;\u63d0\u5347\u67e5\u8be2\u6548\u7387\u3002<\/li>\n<\/ul>\n<h4>\u603b\u7ed3<\/h4>\n<p>\u6587\u6863\u901a\u8fc7\u5927\u91cf\u5b9e\u4f8b\u5c55\u793a\u4e86SQL\u5728\u6570\u636e\u64cd\u4f5c\u4e2d\u7684\u6838\u5fc3\u6280\u672f&#xff0c;\u4ece\u57fa\u7840\u67e5\u8be2\u5230\u9ad8\u7ea7\u805a\u5408\u3001\u5b57\u7b26\u4e32\u5904\u7406\u3001\u5143\u6570\u636e\u67e5\u8be2\u7b49&#xff0c;\u8986\u76d6\u591a\u6570\u636e\u5e93\u5dee\u5f02&#xff0c;\u5f3a\u8c03\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u6700\u4f73\u5b9e\u8df5&#xff08;\u5982\u5904\u7406Null\u503c\u3001\u907f\u514d\u7b1b\u5361\u513f\u79ef\u3001\u5408\u7406\u4f7f\u7528\u7d22\u5f15\u7b49&#xff09;\u3002\u6bcf\u4e2a\u5b9e\u4f8b\u7ed3\u5408\u95ee\u9898\u3001\u89e3\u51b3\u65b9\u6848\u548c\u8ba8\u8bba&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u4e0d\u540c\u573a\u666f\u4e0b\u7684SQL\u7b56\u7565&#xff0c;\u662fSQL\u5f00\u53d1\u548c\u4f18\u5316\u7684\u91cd\u8981\u53c2\u8003\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf21\u6b21\u3002\u6587\u6863\u901a\u8fc7\u5927\u91cf\u5b9e\u4f8b\u5c55\u793a\u4e86SQL\u5728\u6570\u636e\u64cd\u4f5c\u4e2d\u7684\u6838\u5fc3\u6280\u672f\uff0c\u4ece\u57fa\u7840\u67e5\u8be2\u5230\u9ad8\u7ea7\u805a\u5408\u3001\u5b57\u7b26\u4e32\u5904\u7406\u3001\u5143\u6570\u636e\u67e5\u8be2\u7b49\uff0c\u8986\u76d6\u591a\u6570\u636e\u5e93\u5dee\u5f02\uff0c\u5f3a\u8c03\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u6700\u4f73\u5b9e\u8df5\uff08\u5982\u5904\u7406Null\u503c\u3001\u907f\u514d\u7b1b\u5361\u513f\u79ef\u3001\u5408\u7406\u4f7f\u7528\u7d22\u5f15\u7b49\uff09\u3002\u6bcf\u4e2a\u5b9e\u4f8b\u7ed3\u5408\u95ee\u9898\u3001\u89e3\u51b3\u65b9\u6848\u548c\u8ba8\u8bba\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u4e0d\u540c\u573a\u666f\u4e0b\u7684SQL\u7b56\u7565\uff0c\u662fSQL\u5f00\u53d1\u548c\u4f18\u5316\u7684\u91cd\u8981\u53c2\u8003\u3002_sql\u5b9e\u4f8b\u6559\u7a0b<\/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":[768,100],"topic":[],"class_list":["post-38215","post","type-post","status-publish","format-standard","hentry","category-server","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>SQL\u7ecf\u5178\u5b9e\u4f8b - \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\/38215.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL\u7ecf\u5178\u5b9e\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf21\u6b21\u3002\u6587\u6863\u901a\u8fc7\u5927\u91cf\u5b9e\u4f8b\u5c55\u793a\u4e86SQL\u5728\u6570\u636e\u64cd\u4f5c\u4e2d\u7684\u6838\u5fc3\u6280\u672f\uff0c\u4ece\u57fa\u7840\u67e5\u8be2\u5230\u9ad8\u7ea7\u805a\u5408\u3001\u5b57\u7b26\u4e32\u5904\u7406\u3001\u5143\u6570\u636e\u67e5\u8be2\u7b49\uff0c\u8986\u76d6\u591a\u6570\u636e\u5e93\u5dee\u5f02\uff0c\u5f3a\u8c03\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u6700\u4f73\u5b9e\u8df5\uff08\u5982\u5904\u7406Null\u503c\u3001\u907f\u514d\u7b1b\u5361\u513f\u79ef\u3001\u5408\u7406\u4f7f\u7528\u7d22\u5f15\u7b49\uff09\u3002\u6bcf\u4e2a\u5b9e\u4f8b\u7ed3\u5408\u95ee\u9898\u3001\u89e3\u51b3\u65b9\u6848\u548c\u8ba8\u8bba\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u4e0d\u540c\u573a\u666f\u4e0b\u7684SQL\u7b56\u7565\uff0c\u662fSQL\u5f00\u53d1\u548c\u4f18\u5316\u7684\u91cd\u8981\u53c2\u8003\u3002_sql\u5b9e\u4f8b\u6559\u7a0b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/38215.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-19T17:04:24+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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38215.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/38215.html\",\"name\":\"SQL\u7ecf\u5178\u5b9e\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-19T17:04:24+00:00\",\"dateModified\":\"2025-05-19T17:04:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/38215.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/38215.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38215.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL\u7ecf\u5178\u5b9e\u4f8b\"}]},{\"@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":"SQL\u7ecf\u5178\u5b9e\u4f8b - \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\/38215.html","og_locale":"zh_CN","og_type":"article","og_title":"SQL\u7ecf\u5178\u5b9e\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf21\u6b21\u3002\u6587\u6863\u901a\u8fc7\u5927\u91cf\u5b9e\u4f8b\u5c55\u793a\u4e86SQL\u5728\u6570\u636e\u64cd\u4f5c\u4e2d\u7684\u6838\u5fc3\u6280\u672f\uff0c\u4ece\u57fa\u7840\u67e5\u8be2\u5230\u9ad8\u7ea7\u805a\u5408\u3001\u5b57\u7b26\u4e32\u5904\u7406\u3001\u5143\u6570\u636e\u67e5\u8be2\u7b49\uff0c\u8986\u76d6\u591a\u6570\u636e\u5e93\u5dee\u5f02\uff0c\u5f3a\u8c03\u5b9e\u9645\u5e94\u7528\u4e2d\u7684\u6700\u4f73\u5b9e\u8df5\uff08\u5982\u5904\u7406Null\u503c\u3001\u907f\u514d\u7b1b\u5361\u513f\u79ef\u3001\u5408\u7406\u4f7f\u7528\u7d22\u5f15\u7b49\uff09\u3002\u6bcf\u4e2a\u5b9e\u4f8b\u7ed3\u5408\u95ee\u9898\u3001\u89e3\u51b3\u65b9\u6848\u548c\u8ba8\u8bba\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u4e0d\u540c\u573a\u666f\u4e0b\u7684SQL\u7b56\u7565\uff0c\u662fSQL\u5f00\u53d1\u548c\u4f18\u5316\u7684\u91cd\u8981\u53c2\u8003\u3002_sql\u5b9e\u4f8b\u6559\u7a0b","og_url":"https:\/\/www.wsisp.com\/helps\/38215.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-19T17:04:24+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/38215.html","url":"https:\/\/www.wsisp.com\/helps\/38215.html","name":"SQL\u7ecf\u5178\u5b9e\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-19T17:04:24+00:00","dateModified":"2025-05-19T17:04:24+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/38215.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/38215.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/38215.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SQL\u7ecf\u5178\u5b9e\u4f8b"}]},{"@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\/38215","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=38215"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38215\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=38215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=38215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=38215"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=38215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}