{"id":74901,"date":"2026-02-10T22:17:05","date_gmt":"2026-02-10T14:17:05","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/74901.html"},"modified":"2026-02-10T22:17:05","modified_gmt":"2026-02-10T14:17:05","slug":"sql%e5%bf%85%e7%9f%a5%e5%bf%85%e4%bc%9a%e9%9b%b6%e5%9f%ba%e7%a1%80%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8_%e7%89%9b%e5%ae%a2%e5%88%b7%e9%a2%98%e6%8c%87%e5%8d%977281","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/74901.html","title":{"rendered":"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81"},"content":{"rendered":"<h2>SQL72\u00a0\u68c0\u7d22\u5e76\u5217\u51fa\u5df2\u8ba2\u8d2d\u4ea7\u54c1\u7684\u6e05\u5355<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"985\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141702-698b3dde619fe.png\" width=\"1183\" \/><\/p>\n<p># \u65b9\u6cd5\u4e00&#xff1a;<br \/>\nselect order_num,prod_id,quantity<br \/>\nfrom OrderItems<br \/>\nwhere (prod_id &#061; &#039;BR01&#039; or prod_id &#061; &#039;BR02&#039; or prod_id &#061; &#039;BR03&#039;)<br \/>\nand quantity &gt;&#061;100;<\/p>\n<p># \u65b9\u6cd5\u4e8c&#xff1a;<br \/>\nselect order_num,prod_id,quantity<br \/>\nfrom OrderItems<br \/>\nwhere prod_id in(&#039;BR01&#039;,&#039;BR02&#039;,&#039;BR03&#039;)<br \/>\nand quantity &gt;&#061;100;<\/p>\n<p># \u65b9\u6cd5\u4e09<br \/>\nselect order_num,prod_id,quantity<br \/>\nfrom OrderItems<br \/>\nwhere prod_id between &#039;BR01&#039; and &#039;BR03&#039;<br \/>\nand quantity &gt;&#061;100;<\/p>\n<table>\n<tr>\u5199\u6cd5\u7b49\u4ef7\u903b\u8f91\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>OR \u591a\u6761\u4ef6<\/td>\n<td>\u4efb\u610f\u4e00\u4e2a\u7b49\u503c\u5339\u914d<\/td>\n<td>\u5c11\u91cf\u56fa\u5b9a\u503c\u3001\u6559\u5b66\u6f14\u793a<\/td>\n<\/tr>\n<tr>\n<td>IN (\u503c\u5217\u8868)<\/td>\n<td>\u591a OR \u7b80\u5199&#xff0c;\u79bb\u6563\u7b49\u503c\u5339\u914d<\/td>\n<td>\u79bb\u6563\u679a\u4e3e\u503c\u3001\u56fa\u5b9a\u591a\u503c\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td>BETWEEN AND<\/td>\n<td>\u95ed\u533a\u95f4\u8303\u56f4\u6bd4\u8f83<\/td>\n<td>\u8fde\u7eed\u6570\u503c \/ \u65e5\u671f \/ \u8fde\u7eed\u7f16\u7801<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>SQL73\u00a0\u8fd4\u56de\u6240\u6709\u4ef7\u683c\u5728 3\u7f8e\u5143\u5230 6\u7f8e\u5143\u4e4b\u95f4\u7684\u4ea7\u54c1\u7684\u540d\u79f0\u548c\u4ef7\u683c<\/h2>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"720\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141703-698b3ddf014b3.png\" width=\"1192\" \/><\/h2>\n<h4>\u65b9\u6cd5\u4e00:<\/h4>\n<p>select prod_name,prod_price from Products<br \/>\nwhere prod_price&gt;&#061;3 and prod_price&lt;&#061;6<br \/>\norder by prod_price asc; <\/p>\n<h4>\u65b9\u6cd5\u4e8c:<\/h4>\n<p>select prod_name,prod_price from Products<br \/>\nwhere prod_price BETWEEN 3 AND 6<br \/>\norder by prod_price asc; <\/p>\n<h2>SQL74\u00a0\u7ea0\u95192<\/h2>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"715\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141703-698b3ddf5966f.png\" width=\"988\" \/><\/h2>\n<p>SELECT vend_name<br \/>\nFROM Vendors<br \/>\nWHERE vend_country &#061; &#039;USA&#039; AND vend_state &#061; &#039;CA&#039;<br \/>\nORDER BY vend_name; <\/p>\n<h4>\u4e00\u3001Mysql\u00a0\u8bed\u6cd5\u987a\u5e8f<\/h4>\n<table>\n<tr>\u5e8f\u53f7\u5173\u952e\u5b57 \/ \u5b50\u53e5\u6838\u5fc3\u4f5c\u7528\u8bf4\u660e\u5907\u6ce8<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>SELECT [DISTINCT]<\/td>\n<td>\u6307\u5b9a\u67e5\u8be2\u7684\u5217\u3001\u53bb\u91cd\u3001\u805a\u5408\u51fd\u6570<\/td>\n<td>\u67e5\u8be2\u7ed3\u679c\u5217\u5b9a\u4e49&#xff0c;\u53ef\u642d\u914d DISTINCT \u53bb\u91cd<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>FROM<\/td>\n<td>\u6307\u5b9a\u6570\u636e\u6765\u6e90\u7684\u4e3b\u8868<\/td>\n<td>\u5fc5\u9009\u5b50\u53e5&#xff0c;\u5b9a\u4e49\u64cd\u4f5c\u7684\u57fa\u7840\u8868<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>JOIN<\/td>\n<td>\u5173\u8054\u5176\u4ed6\u8868&#xff08;\u5185\u8fde\u63a5\u3001\u5de6\u8fde\u63a5\u3001\u53f3\u8fde\u63a5\u7b49&#xff09;<\/td>\n<td>\u591a\u8868\u67e5\u8be2\u4f7f\u7528&#xff0c;\u62fc\u63a5\u5173\u8054\u8868<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>ON<\/td>\n<td>\u591a\u8868\u8fde\u63a5\u7684\u5339\u914d\u6761\u4ef6<\/td>\n<td>\u914d\u5408 JOIN \u4f7f\u7528&#xff0c;\u4e0d\u53ef\u5355\u72ec\u5199\u5728 WHERE \u524d<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>WHERE<\/td>\n<td>\u5bf9\u539f\u59cb\u6570\u636e\u884c\u8fdb\u884c\u8fc7\u6ee4<\/td>\n<td>\u8fc7\u6ee4\u57fa\u7840\u8868\u6570\u636e&#xff0c;\u4e0d\u652f\u6301\u805a\u5408\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>GROUP BY<\/td>\n<td>\u5bf9\u6570\u636e\u8fdb\u884c\u5206\u7ec4\u7edf\u8ba1<\/td>\n<td>\u914d\u5408\u805a\u5408\u51fd\u6570&#xff08;SUM\/COUNT\/AVG \u7b49&#xff09;\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>HAVING<\/td>\n<td>\u5bf9\u5206\u7ec4\u540e\u7684\u7ed3\u679c\u8fdb\u884c\u8fc7\u6ee4<\/td>\n<td>\u4ec5\u80fd\u8fc7\u6ee4\u5206\u7ec4 \/ \u805a\u5408\u540e\u6570\u636e&#xff0c;\u53ef\u4f7f\u7528\u805a\u5408\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>UNION<\/td>\n<td>\u5408\u5e76\u591a\u4e2a\u67e5\u8be2\u7ed3\u679c\u96c6<\/td>\n<td>\u5408\u5e76\u53bb\u91cd&#xff0c;UNION ALL \u4e3a\u4e0d\u53bb\u91cd\u5408\u5e76<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>ORDER BY<\/td>\n<td>\u5bf9\u6700\u7ec8\u7ed3\u679c\u96c6\u8fdb\u884c\u6392\u5e8f<\/td>\n<td>\u5347\u5e8f ASC\u3001\u964d\u5e8f DESC&#xff0c;\u9ed8\u8ba4 ASC<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>LIMIT<\/td>\n<td>\u9650\u5236\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570&#xff08;\u5206\u9875&#xff09;<\/td>\n<td>MySQL \u7279\u6709&#xff0c;\u7528\u4e8e\u622a\u53d6\u7ed3\u679c\u6761\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u4e8c\u3001Mysql\u6267\u884c\u987a\u5e8f<\/h4>\n<table>\n<tr>\u5e8f\u53f7\u5173\u952e\u5b57 \/ \u5b50\u53e5\u6838\u5fc3\u4f5c\u7528\u8bf4\u660e\u5173\u952e\u77e5\u8bc6\u70b9<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>FROM<\/td>\n<td>\u52a0\u8f7d\u4e3b\u8868\u5230\u5185\u5b58&#xff0c;\u786e\u5b9a\u6570\u636e\u57fa\u7840\u6e90<\/td>\n<td>\u6267\u884c\u7b2c\u4e00\u6b65&#xff0c;\u5148\u627e\u8868<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>ON<\/td>\n<td>\u6267\u884c\u591a\u8868\u8fde\u63a5\u7684\u5339\u914d\u6761\u4ef6\u8fc7\u6ee4<\/td>\n<td>\u5148\u5339\u914d\u5173\u8054\u6761\u4ef6&#xff0c;\u518d\u751f\u6210\u4e34\u65f6\u8868<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>JOIN<\/td>\n<td>\u62fc\u63a5\u5173\u8054\u8868&#xff0c;\u751f\u6210\u591a\u8868\u8054\u5408\u4e34\u65f6\u8868<\/td>\n<td>ON \u548c JOIN \u8054\u52a8&#xff0c;\u5b8c\u6210\u8868\u8fde\u63a5<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>WHERE<\/td>\n<td>\u8fc7\u6ee4\u8fde\u63a5\u540e\u7684\u539f\u59cb\u884c\u6570\u636e<\/td>\n<td>\u8fc7\u6ee4\u672a\u5206\u7ec4\u7684\u57fa\u7840\u6570\u636e&#xff0c;\u6548\u7387\u6700\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>GROUP BY<\/td>\n<td>\u5bf9\u8fc7\u6ee4\u540e\u7684\u6570\u636e\u8fdb\u884c\u5206\u7ec4<\/td>\n<td>\u5206\u7ec4\u540e\u5f62\u6210\u5206\u7ec4\u805a\u5408\u7684\u4e34\u65f6\u7ed3\u679c<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>HAVING<\/td>\n<td>\u8fc7\u6ee4\u5206\u7ec4\u5b8c\u6210\u540e\u7684\u805a\u5408\u7ed3\u679c<\/td>\n<td>\u9488\u5bf9\u5206\u7ec4\u540e\u6570\u636e&#xff0c;WHERE \u65e0\u6cd5\u66ff\u4ee3<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>SELECT<\/td>\n<td>\u786e\u5b9a\u6700\u7ec8\u8981\u5c55\u793a\u7684\u5217\u3001\u8ba1\u7b97\u5217\u3001\u805a\u5408\u5217<\/td>\n<td>\u6267\u884c\u5230\u8fd9\u4e00\u6b65\u624d\u786e\u5b9a\u67e5\u8be2\u5217<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>DISTINCT<\/td>\n<td>\u5bf9\u67e5\u8be2\u7ed3\u679c\u8fdb\u884c\u53bb\u91cd\u5904\u7406<\/td>\n<td>\u5728 SELECT \u4e4b\u540e&#xff0c;\u5bf9\u7ed3\u679c\u96c6\u53bb\u91cd<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>UNION<\/td>\n<td>\u5408\u5e76\u591a\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\u96c6<\/td>\n<td>\u5408\u5e76\u6240\u6709\u6ee1\u8db3\u6761\u4ef6\u7684\u67e5\u8be2\u7ed3\u679c<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>ORDER BY<\/td>\n<td>\u5bf9\u6700\u7ec8\u7ed3\u679c\u96c6\u8fdb\u884c\u6392\u5e8f<\/td>\n<td>\u6700\u540e\u6392\u5e8f&#xff0c;\u6392\u5e8f\u662f\u8017\u65f6\u64cd\u4f5c&#xff0c;\u653e\u6700\u540e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>\u4e66\u5199\u987a\u5e8f \u2260 \u6267\u884c\u987a\u5e8f&#xff0c;WHERE \u5148\u6267\u884c&#xff0c;SELECT \u540e\u6267\u884c&#xff0c;\u6240\u4ee5 WHERE \u91cc\u4e0d\u80fd\u7528 SELECT \u5b9a\u4e49\u7684\u522b\u540d\u3002<\/li>\n<li>ON &#x1f19a;\u00a0WHERE&#xff1a;ON \u662f\u8868\u8fde\u63a5\u65f6\u8fc7\u6ee4&#xff0c;WHERE \u662f\u8fde\u63a5\u5b8c\u6210\u540e\u8fc7\u6ee4&#xff0c;\u5de6\u8fde\u63a5 \/ \u53f3\u8fde\u63a5\u65f6&#xff0c;\u4e8c\u8005\u7ed3\u679c\u4f1a\u4e0d\u540c\u3002<\/li>\n<li>WHERE &#x1f19a;\u00a0HAVING&#xff1a;WHERE \u8fc7\u6ee4\u539f\u59cb\u884c&#xff0c;\u4e0d\u80fd\u7528\u805a\u5408\u51fd\u6570&#xff1b;HAVING \u8fc7\u6ee4\u5206\u7ec4\u7ed3\u679c&#xff0c;\u53ea\u80fd\u914d\u5408 GROUP BY \u4f7f\u7528\u3002<\/li>\n<li>ORDER BY\u3001LIMIT \u6c38\u8fdc\u5728\u6267\u884c\u7684\u6700\u540e\u9636\u6bb5&#xff0c;\u662f\u5bf9\u6700\u7ec8\u7ed3\u679c\u96c6\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<h2>SQL75\u00a0\u68c0\u7d22\u4ea7\u54c1\u540d\u79f0\u548c\u63cf\u8ff0&#xff08;\u4e00&#xff09;<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"702\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141703-698b3ddf8d1cb.png\" width=\"1194\" \/><\/p>\n<p>select prod_name,prod_desc from Products<br \/>\nwhere prod_desc like &#039;%toy%&#039;; <\/p>\n<p>\u5173\u952e\u8bcd&#xff1a;<span style=\"color:#4da8ee\">like<\/span><\/p>\n<p>\u7528\u6cd5&#xff1a;[\u5b57\u7b26] like &#039;%_[]\u5b57\u7b26&#039;<\/p>\n<ul>\n<li>%\u8868\u793a\u4efb\u4f55\u5b57\u7b26\u51fa\u73b0\u4efb\u610f\u6b21\u6570<\/li>\n<li>_\u8868\u793a\u5355\u4e2a\u5b57\u7b26<\/li>\n<li>[]\u8868\u793a\u4e00\u4e2a\u5b57\u7b26\u96c6<\/li>\n<\/ul>\n<h2>SQL76\u00a0\u68c0\u7d22\u4ea7\u54c1\u540d\u79f0\u548c\u63cf\u8ff0&#xff08;\u4e8c&#xff09;<\/h2>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"799\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141703-698b3ddfdedbe.png\" width=\"1201\" \/><\/h2>\n<h4>\u65b9\u6cd51&#xff1a;\u00a0INSTR\u51fd\u6570\u7528\u6cd5<\/h4>\n<p>mysql\u00a0\u8fdb\u884c\u6a21\u7cca\u67e5\u8be2\u65f6&#xff0c;\u53ef\u4f7f\u7528\u5185\u90e8\u51fd\u6570 instr&#xff0c;\u66ff\u4ee3\u4f20\u7edf\u7684 like \u65b9\u5f0f&#xff0c;\u5e76\u4e14\u901f\u5ea6\u66f4\u5feb\u3002<\/p>\n<p>instr(field, str) \u51fd\u6570&#xff0c;\u7b2c\u4e00\u4e2a\u53c2\u6570 field \u662f\u5b57\u6bb5&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570 str \u662f\u8981\u67e5\u8be2\u7684\u4e32&#xff0c;\u8fd4\u56de\u4e32 str \u7684\u4f4d\u7f6e&#xff0c;\u6ca1\u627e\u5230\u5c31\u662f0<\/p>\n<p>select prod_name,prod_desc from Products<br \/>\nwhere instr(prod_desc,&#034;toy&#034;)&#061;0<br \/>\norder by prod_name; <\/p>\n<h4>\u65b9\u6cd52&#xff1a;<span style=\"color:#4da8ee\">not like<\/span><\/h4>\n<p>select prod_name,prod_desc from Products<br \/>\nwhere prod_desc not like &#039;%toy%&#039;<br \/>\norder by prod_name; <\/p>\n<h4>\u65b9\u6cd53&#xff1a;<span style=\"color:#4da8ee\">locate<\/span>(str,sub)<\/h4>\n<p>Locate(str,sub) &gt; 0&#xff0c;\u8868\u793asub\u5b57\u7b26\u4e32\u5305\u542bstr\u5b57\u7b26\u4e32&#xff1b;<\/p>\n<p>Locate(str,sub) &#061; 0&#xff0c;\u8868\u793asub\u5b57\u7b26\u4e32\u4e0d\u5305\u542bstr\u5b57\u7b26\u4e32\u3002<\/p>\n<p>select prod_name,prod_desc from Products<br \/>\nwhere locate(&#034;toy&#034;,prod_desc)&#061;0<br \/>\norder by prod_name; <\/p>\n<h2>SQL77\u00a0\u68c0\u7d22\u4ea7\u54c1\u540d\u79f0\u548c\u63cf\u8ff0&#xff08;\u4e09&#xff09;<\/h2>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"445\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141704-698b3de03e59a.png\" width=\"733\" \/><\/h2>\n<p>select prod_name,prod_desc<br \/>\nfrom Products<br \/>\nwhere prod_desc like &#034;%toy%&#034; and prod_desc like &#034;%carrots%&#034;; <\/p>\n<h2><span style=\"color:#4da8ee\">LIKE<\/span>\u64cd\u4f5c\u7b26<\/h2>\n<p><span style=\"color:#4da8ee\">LIKE<\/span> \u662f SQL \u4e2d\u7528\u4e8e\u6a21\u7cca\u5339\u914d\u5b57\u7b26\u4e32\u7684\u64cd\u4f5c\u7b26&#xff0c;\u5b83\u548c &#061; \u4e0d\u540c&#xff1a;<\/p>\n<ul>\n<li>&#061; \u8981\u6c42\u5b8c\u5168\u76f8\u7b49&#xff08;\u7cbe\u786e\u5339\u914d&#xff09;<\/li>\n<li>LIKE \u5141\u8bb8\u7528\u901a\u914d\u7b26\u6765\u5339\u914d\u7b26\u5408\u67d0\u79cd\u6a21\u5f0f\u7684\u5b57\u7b26\u4e32<\/li>\n<\/ul>\n<h4>% \u662f LIKE \u4e2d\u5e38\u7528\u7684\u901a\u914d\u7b26<\/h4>\n<table>\n<tr>\u6a21\u5f0f\u542b\u4e49\u793a\u4f8b\u5339\u914d<\/tr>\n<tbody>\n<tr>\n<td>&#034;toy%&#034;<\/td>\n<td>\u4ee5 toy \u5f00\u5934\u7684\u5b57\u7b26\u4e32<\/td>\n<td>toy car, toys<\/td>\n<\/tr>\n<tr>\n<td>&#034;%toy&#034;<\/td>\n<td>\u4ee5 toy \u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32<\/td>\n<td>stuffed toy, action toy<\/td>\n<\/tr>\n<tr>\n<td>&#034;%toy%&#034;<\/td>\n<td>\u5305\u542b toy \u7684\u5b57\u7b26\u4e32&#xff08;\u4f4d\u7f6e\u4e0d\u9650&#xff09;<\/td>\n<td>the toy box, toy story<\/td>\n<\/tr>\n<tr>\n<td>&#034;%&#034;<\/td>\n<td>\u5339\u914d\u4efb\u610f\u5b57\u7b26\u4e32&#xff08;\u76f8\u5f53\u4e8e\u6ca1\u6709\u9650\u5236&#xff09;<\/td>\n<td>\u6240\u6709\u975e\u7a7a\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u53e6\u4e00\u4e2a\u5e38\u7528\u901a\u914d\u7b26 _<\/h4>\n<table>\n<tr>\u6a21\u5f0f\u542b\u4e49\u793a\u4f8b\u5339\u914d<\/tr>\n<tbody>\n<tr>\n<td>&#039;t_y&#039;<\/td>\n<td>\u7b2c 1 \u4f4d\u662f t&#xff0c;\u7b2c 3 \u4f4d\u662f y&#xff0c;\u4e2d\u95f4\u4efb\u610f<\/td>\n<td>tay, tby, tcy<\/td>\n<\/tr>\n<tr>\n<td>&#039;to_&#039;<\/td>\n<td>\u4ee5 to \u5f00\u5934&#xff0c;\u540e\u9762\u8ddf 1 \u4e2a\u5b57\u7b26<\/td>\n<td>too, top, toy<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>SQL78\u00a0\u68c0\u7d22\u4ea7\u54c1\u540d\u79f0\u548c\u63cf\u8ff0&#xff08;\u56db&#xff09;<\/h2>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"442\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141704-698b3de054830.png\" width=\"677\" \/><\/h2>\n<p>select prod_name,prod_desc<br \/>\nfrom Products<br \/>\nwhere prod_desc like &#034;%toy%carrots%&#034;; <\/p>\n<h2>SQL79\u00a0\u522b\u540d<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"587\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141704-698b3de06ae9f.png\" width=\"766\" \/><\/p>\n<p>select vend_id,<br \/>\nvend_name as vname,<br \/>\nvend_address as vaddress,<br \/>\nvend_city as vcity from Vendors<br \/>\norder by vname; <\/p>\n<h3><span style=\"color:#4da8ee\">AS<\/span>\u53ef\u4ee5\u7701\u7565&#xff1a;<\/h3>\n<p>select vend_id,<br \/>\nvend_name vname,<br \/>\nvend_address vaddress,<br \/>\nvend_city vcity<br \/>\nfrom Vendors<br \/>\norder by vname; <\/p>\n<p><span style=\"color:#fe2c24\">\u6613\u9519\u70b9<\/span>&#xff1a;vcity \u5728\u6700\u540e\u8fb9&#xff0c;\u4f4d\u7f6e\u4e5f\u4f1a\u5bfc\u81f4\u9519\u8bef<\/p>\n<h2>SQL80\u00a0\u6253\u6298<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"360\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141704-698b3de0847f1.png\" width=\"709\" \/><\/p>\n<p>select prod_id,<br \/>\nprod_price,<br \/>\nprod_price*0.9 sale_price<br \/>\nfrom Products;<\/p>\n<p>\u4e0eSQL79\u522b\u540d\u77e5\u8bc6\u70b9\u76f8\u4f3c<\/p>\n<h2>SQL81 \u987e\u5ba2\u767b\u5f55\u540d<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"486\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141704-698b3de09856e.png\" width=\"708\" \/><\/p>\n<p>select cust_id,<br \/>\ncust_name,<br \/>\nupper(concat(substring(cust_contact,1,2),substring(cust_city,1,3))) user_login<br \/>\nfrom Customers; <\/p>\n<h4>\u5173\u952e\u8bcd&#xff1a;substing,concat,upper<\/h4>\n<ul>\n<li>\u5b57\u7b26\u4e32\u7684\u622a\u53d6&#xff1a;<span style=\"color:#4da8ee\">substring<\/span>(\u5b57\u7b26\u4e32&#xff0c;\u8d77\u59cb\u4f4d\u7f6e&#xff0c;\u622a\u53d6\u5b57\u7b26\u6570&#xff09;<\/li>\n<li>\u5b57\u7b26\u4e32\u7684\u62fc\u63a5&#xff1a;<span style=\"color:#4da8ee\">concat<\/span>(\u5b57\u7b26\u4e321&#xff0c;\u5b57\u7b26\u4e322&#xff0c;\u5b57\u7b26\u4e323,&#8230;)<\/li>\n<li>\u5b57\u6bcd\u5927\u5199&#xff1a;<span style=\"color:#4da8ee\">upper<\/span>(\u5b57\u7b26\u4e32)\u00a0 \u00a0\u8865\u5145:<span style=\"color:#4da8ee\">lower<\/span>(\u5b57\u7b26\u4e32)\u5c0f\u5199<\/li>\n<\/ul>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL72\u00a0\u68c0\u7d22\u5e76\u5217\u51fa\u5df2\u8ba2\u8d2d\u4ea7\u54c1\u7684\u6e05\u5355 # \u65b9\u6cd5\u4e00&#xff1a;<br \/>\nselect order_num,prod_id,quantity<br \/>\nfrom OrderItems<br \/>\nwhere (prod_id  BR01 or prod_id  BR02 or prod_id  BR03)<br \/>\nand quantity &gt;100;# \u65b9\u6cd5\u4e8c&#xff1a;<br \/>\nselect order_num,prod_id,quantity<br \/>\nfrom OrderItems<br \/>\nwhere prod_id in<\/p>\n","protected":false},"author":2,"featured_media":74891,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[114,768,87,100],"topic":[],"class_list":["post-74901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-mysql","tag-sql","tag-87","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \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\/74901.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"SQL72\u00a0\u68c0\u7d22\u5e76\u5217\u51fa\u5df2\u8ba2\u8d2d\u4ea7\u54c1\u7684\u6e05\u5355 # \u65b9\u6cd5\u4e00&#xff1a; select order_num,prod_id,quantity from OrderItems where (prod_id BR01 or prod_id BR02 or prod_id BR03) and quantity &gt;100;# \u65b9\u6cd5\u4e8c&#xff1a; select order_num,prod_id,quantity from OrderItems where prod_id in\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/74901.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-10T14:17:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141702-698b3dde619fe.png\" \/>\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\/74901.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/74901.html\",\"name\":\"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-10T14:17:05+00:00\",\"dateModified\":\"2026-02-10T14:17:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/74901.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/74901.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/74901.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81\"}]},{\"@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\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \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\/74901.html","og_locale":"zh_CN","og_type":"article","og_title":"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"SQL72\u00a0\u68c0\u7d22\u5e76\u5217\u51fa\u5df2\u8ba2\u8d2d\u4ea7\u54c1\u7684\u6e05\u5355 # \u65b9\u6cd5\u4e00&#xff1a; select order_num,prod_id,quantity from OrderItems where (prod_id BR01 or prod_id BR02 or prod_id BR03) and quantity &gt;100;# \u65b9\u6cd5\u4e8c&#xff1a; select order_num,prod_id,quantity from OrderItems where prod_id in","og_url":"https:\/\/www.wsisp.com\/helps\/74901.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-10T14:17:05+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260210141702-698b3dde619fe.png"}],"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\/74901.html","url":"https:\/\/www.wsisp.com\/helps\/74901.html","name":"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-10T14:17:05+00:00","dateModified":"2026-02-10T14:17:05+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/74901.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/74901.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/74901.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SQL\u5fc5\u77e5\u5fc5\u4f1a\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8_\u725b\u5ba2\u5237\u9898\u6307\u5357:72~81"}]},{"@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\/74901","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=74901"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/74901\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/74891"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=74901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=74901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=74901"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=74901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}