{"id":323,"date":"2021-04-28T10:41:01","date_gmt":"2021-04-28T02:41:01","guid":{"rendered":"http:\/\/112.124.66.68\/?p=323"},"modified":"2021-04-28T10:41:01","modified_gmt":"2021-04-28T02:41:01","slug":"%e6%95%b0%e6%8d%ae%e5%ba%93%e7%b4%a2%e5%bc%95","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2021\/04\/28\/%e6%95%b0%e6%8d%ae%e5%ba%93%e7%b4%a2%e5%bc%95\/","title":{"rendered":"\u6570\u636e\u5e93\u7d22\u5f15"},"content":{"rendered":"\n<p><strong>\u7d22\u5f15\uff1a<\/strong><\/p>\n\n\n\n<p>\u5728\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\uff0c\u7d22\u5f15\u662f\u4e00\u79cd\u5355\u72ec\u7684\u3001\u7269\u7406\u7684\u5bf9\u6570\u636e\u5e93\u8868\u4e2d\u4e00\u5217\u6216\u591a\u5217\u7684\u503c\u8fdb\u884c\u6392\u5e8f\u7684\u4e00\u79cd<span class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>\u5b58\u50a8\u7ed3\u6784<\/strong><\/span>\u3002<\/p>\n\n\n\n<p><strong>\u4f18\u70b9<\/strong><\/p>\n\n\n\n<p>1.\u5927\u5927<strong>\u52a0\u5feb<\/strong>\u6570\u636e\u7684\u68c0\u7d22\u901f\u5ea6;<\/p>\n\n\n\n<p>2.\u521b\u5efa\u552f\u4e00\u6027\u7d22\u5f15\uff0c\u4fdd\u8bc1\u6570\u636e\u5e93\u8868\u4e2d\u6bcf\u4e00\u884c\u6570\u636e\u7684<strong>\u552f\u4e00\u6027<\/strong>;<\/p>\n\n\n\n<p>3.<strong>\u52a0\u901f\u8868\u548c\u8868\u4e4b\u95f4\u7684\u8fde\u63a5<\/strong>;<\/p>\n\n\n\n<p>4.\u5728\u4f7f\u7528\u5206\u7ec4\u548c\u6392\u5e8f\u5b50\u53e5\u8fdb\u884c\u6570\u636e\u68c0\u7d22\u65f6\uff0c\u53ef\u4ee5<strong>\u663e\u8457\u51cf\u5c11\u67e5\u8be2\u4e2d\u5206\u7ec4\u548c\u6392\u5e8f\u7684\u65f6\u95f4<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u7f3a\u70b9<\/strong><\/p>\n\n\n\n<p>1.\u7d22\u5f15\u9700\u8981<strong>\u5360\u7269\u7406\u7a7a\u95f4<\/strong>\u3002<\/p>\n\n\n\n<p>2.\u5f53\u5bf9\u8868\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u589e\u52a0\u3001\u5220\u9664\u548c\u4fee\u6539\u7684\u65f6\u5019\uff0c\u7d22\u5f15\u4e5f\u8981\u52a8\u6001\u7684\u7ef4\u62a4\uff0c<strong>\u964d\u4f4e\u4e86\u6570\u636e\u7684\u7ef4\u62a4\u901f\u5ea6<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u7d22\u5f15\u7c7b\u578b<\/strong><\/p>\n\n\n\n<p>\u6839\u636e\u6570\u636e\u5e93\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u5728<a href=\"https:\/\/baike.baidu.com\/item\/%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1\" target=\"_blank\" rel=\"noreferrer noopener\">\u6570\u636e\u5e93\u8bbe\u8ba1<\/a>\u5668\u4e2d\u521b\u5efa\u56db\u79cd\u7d22\u5f15\uff1a\u666e\u901a\u7d22\u5f15\u3001<a href=\"https:\/\/baike.baidu.com\/item\/%E5%94%AF%E4%B8%80%E7%B4%A2%E5%BC%95\" target=\"_blank\" rel=\"noreferrer noopener\">\u552f\u4e00\u7d22\u5f15<\/a>\u3001\u4e3b\u952e\u7d22\u5f15\u548c<a href=\"https:\/\/baike.baidu.com\/item\/%E8%81%9A%E9%9B%86%E7%B4%A2%E5%BC%95\" target=\"_blank\" rel=\"noreferrer noopener\">\u805a\u96c6\u7d22\u5f15<\/a>\u3002<\/p>\n\n\n\n<p><strong>\u4e3b\u952e\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u7b80\u79f0\u4e3a\u4e3b\u7d22\u5f15\uff0c\u6570\u636e\u5e93\u8868\u4e2d\u4e00\u5217\u6216\u5217\u7ec4\u5408\uff08\u5b57\u6bb5\uff09\u7684\u503c\u552f\u4e00\u6807\u8bc6\u8868\u4e2d\u7684\u6bcf\u4e00\u884c\u3002\u8be5\u5217\u79f0\u4e3a\u8868\u7684\u4e3b\u952e\u3002<\/p>\n\n\n\n<p><strong>\u805a\u96c6\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u4e5f\u79f0\u4e3a\u805a\u7c07\u7d22\u5f15\uff0c\u5728<a href=\"https:\/\/baike.baidu.com\/item\/%E8%81%9A%E9%9B%86%E7%B4%A2%E5%BC%95\" target=\"_blank\" rel=\"noreferrer noopener\">\u805a\u96c6\u7d22\u5f15<\/a>\u4e2d\uff0c\u8868\u4e2d\u884c\u7684\u7269\u7406\u987a\u5e8f\u4e0e\u952e\u503c\u7684\u903b\u8f91\uff08\u7d22\u5f15\uff09\u987a\u5e8f\u76f8\u540c\u3002<\/p>\n\n\n\n<p><strong>\u5019\u9009\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u4e0e\u4e3b\u7d22\u5f15\u4e00\u6837\u8981\u6c42\u5b57\u6bb5\u503c\u7684\u552f\u4e00\u6027\uff0c\u5e76\u51b3\u5b9a\u4e86\u5904\u7406\u8bb0\u5f55\u7684\u987a\u5e8f\u3002<\/p>\n\n\n\n<p>\u805a\u96c6\u7d22\u5f15\u901a\u5e38\u63d0\u4f9b\u66f4\u5feb\u7684\u6570\u636e\u8bbf\u95ee\u901f\u5ea6\u3002\u805a\u96c6\u7d22\u5f15\u66f4\u9002\u7528\u4e8e\u5bf9\u5f88\u5c11\u5bf9\u57fa\u8868\u8fdb\u884c\u589e\u5220\u6539\u64cd\u4f5c\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<p><strong>\u975e\u805a\u96c6\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u4e5f\u53eb\u975e\u7c07\u7d22\u5f15\uff0c\u5728\u975e\u805a\u96c6\u7d22\u5f15\u4e2d\uff0c\u6570\u636e\u5e93\u8868\u4e2d\u8bb0\u5f55\u7684\u7269\u7406\u987a\u5e8f\u4e0e\u7d22\u5f15\u987a\u5e8f\u53ef\u4ee5\u4e0d\u76f8\u540c\u3002<\/p>\n\n\n\n<p><strong>SQL\u8bed\u53e5\uff1a<\/strong><\/p>\n\n\n\n<p>\u521b\u5efa\u7d22\u5f15\uff0c\u4f8b\u5982CREATE INDEX &lt;\u7d22\u5f15\u7684\u540d\u5b57&gt; ON tablename (\u5217\u7684\u5217\u8868)\uff1b<\/p>\n\n\n\n<p>\u4fee\u6539\u8868\uff0c\u4f8b\u5982<strong>ALTER TABLE tablename ADD INDEX [\u7d22\u5f15\u7684\u540d\u5b57] (\u5217\u7684\u5217\u8868)\uff1b<\/strong><\/p>\n\n\n\n<p>\u521b\u5efa\u8868\u7684\u65f6\u5019\u6307\u5b9a\u7d22\u5f15\uff0c\u4f8b\u5982   <strong>CREATE TABLE tablename ( [&#8230;], INDEX [\u7d22\u5f15\u7684\u540d\u5b57] (\u5217\u7684\u5217\u8868) )\uff1b<\/strong><\/p>\n\n\n\n<p><strong>CREATE INDEX item_name_index ON trwtctest1 (ITEM_NAME)<\/strong><\/p>\n\n\n\n<p>UNIQUE\u2014\u2014\u5efa\u7acb\u552f\u4e00\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>CLUSTERED\u2014\u2014\u5efa\u7acb\u805a\u96c6\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>NONCLUSTERED\u2014\u2014\u5efa\u7acb\u975e\u805a\u96c6\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u6839\u636e\u8868\u540d\uff0c\u67e5\u8be2\u4e00\u5f20\u8868\u7684\u7d22\u5f15\uff1aselect * from user_indexes where table_name=upper(&#8216;\u8868\u540d&#8217;)<\/p>\n\n\n\n<p>\u6839\u636e\u7d22\u5f15\u53f7\uff0c\u67e5\u8be2\u8868\u7d22\u5f15\u5b57\u6bb5\uff1aselect * from user_ind_columns where index_name=(&#8216;\u7d22\u5f15\u540d&#8217;)<\/p>\n\n\n\n<p><strong>&nbsp;\u5220\u9664\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u5f53\u67d0\u4e2a\u65f6\u671f\u57fa\u672c\u8868\u4e2d\u6570\u636e\u66f4\u65b0\u9891\u7e41\u6216\u8005\u67d0\u4e2a\u7d22\u5f15\u4e0d\u5728\u9700\u8981\u65f6\uff0c\u9700\u8981\u5220\u9664\u90e8\u5206\u7d22\u5f15\u3002SQL\u8bed\u8a00\u4f7f\u7528DROP INDEX \u8bed\u53e5\u5220\u9664\u7d22\u5f15\uff0c\u5176\u4e00\u822c\u683c\u5f0f\u662f\uff1a<\/p>\n\n\n\n<p>DROP INDEX&lt;\u7d22\u5f15\u540d&gt;<\/p>\n\n\n\n<p><strong>\u4fee\u6539\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u5bf9\u4e8e\u5df2\u7ecf\u5efa\u7acb\u7684\u7d22\u5f15\uff0c\u5982\u679c\u9700\u8981\u5bf9\u5176\u91cd\u65b0\u547d\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528ALTER INDEX \u8bed\u53e5\u3002\u5176\u4e00\u822c\u683c\u5f0f\u4e3a<\/p>\n\n\n\n<p>ALTER INDEX &lt;\u65e7\u5f15\u7d22\u540d\u5b57&gt; RENAME TO&lt;\u65b0\u5f15\u7d22\u540d&gt;<\/p>\n\n\n\n<p><strong>\u590d\u5408\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u7528\u6237\u53ef\u4ee5\u5728\u591a\u4e2a\u5217\u4e0a\u5efa\u7acb\u7d22\u5f15,\u8fd9\u79cd\u7d22\u5f15\u53eb\u505a\u590d\u5408\u7d22\u5f15(\u7ec4\u5408\u7d22\u5f15); &nbsp; &nbsp; \u590d\u5408\u7d22\u5f15\u5728\u6570\u636e\u5e93\u64cd\u4f5c\u671f\u95f4\u6240\u9700\u7684\u5f00\u9500\u66f4\u5c0f,\u53ef\u4ee5\u4ee3\u66ff\u591a\u4e2a\u5355\u4e00\u7d22\u5f15; &nbsp; &nbsp; \u540c\u65f6\u6709\u4e24\u4e2a\u6982\u5ff5\u53eb\u505a\u7a84\u7d22\u5f15\u548c\u5bbd\u7d22\u5f15,\u7a84\u7d22\u5f15\u662f\u6307\u7d22\u5f15\u5217\u4e3a1-2\u5217\u7684\u7d22\u5f15,\u5bbd\u7d22\u5f15\u4e5f\u5c31\u662f\u7d22\u5f15\u5217\u8d85\u8fc72\u5217\u7684\u7d22\u5f15; &nbsp; &nbsp; \u8bbe\u8ba1\u7d22\u5f15\u7684\u4e00\u4e2a\u91cd\u8981\u539f\u5219\u5c31\u662f\u80fd\u7528\u7a84\u7d22\u5f15\u4e0d\u7528\u5bbd\u7d22\u5f15,\u56e0\u4e3a\u7a84\u7d22\u5f15\u5f80\u5f80\u6bd4\u7ec4\u5408\u7d22\u5f15\u66f4\u6709\u6548;<\/p>\n\n\n\n<p>\u521b\u5efa\u7d22\u5f15 \u00a0 \u00a0 create index idx1 on table1(col1,col2,col3)\u00a0 \u00a0 \u00a0 <\/p>\n\n\n\n<p>\u67e5\u8be2 \u00a0 \u00a0 select * from table1 where col1= A and col2= B and col3 = C \u00a0 \u00a0 <\/p>\n\n\n\n<p>\u8fd9\u65f6\u5019\u67e5\u8be2\u4f18\u5316\u5668,\u4e0d\u5728\u626b\u63cf\u8868\u4e86,\u800c\u662f\u76f4\u63a5\u7684\u4ece\u7d22\u5f15\u4e2d\u62ff\u6570\u636e,\u56e0\u4e3a\u7d22\u5f15\u4e2d\u6709\u8fd9\u4e9b\u6570\u636e,\u8fd9\u53eb\u8986\u76d6\u5f0f\u67e5\u8be2,\u8fd9\u6837\u7684\u67e5\u8be2\u901f\u5ea6\u975e\u5e38\u5feb;\u00a0\u00a0<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u590d\u5408\u7d22\u5f15,\u5728\u67e5\u8be2\u4f7f\u7528\u65f6,\u6700\u597d\u5c06\u6761\u4ef6\u987a\u5e8f\u6309\u627e\u7d22\u5f15\u7684\u987a\u5e8f,\u8fd9\u6837\u6548\u7387\u6700\u9ad8; &nbsp; &nbsp; select * from table1 where col1=A AND col2=B AND col3=D &nbsp; &nbsp; \u5982\u679c\u4f7f\u7528 where col2=B AND col1=A \u6216\u8005 where col2=B \u5c06\u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15<\/p>\n\n\n\n<p>\u6839\u636ewhere\u6761\u4ef6\u5efa\u7d22\u5f15\u662f\u6781\u5176\u91cd\u8981\u7684\u4e00\u4e2a\u539f\u5219; &nbsp; &nbsp; \u6ce8\u610f\u4e0d\u8981\u8fc7\u591a\u7528\u7d22\u5f15,\u5426\u5219\u5bf9\u8868\u66f4\u65b0\u7684\u6548\u7387\u6709\u5f88\u5927\u7684\u5f71\u54cd,\u56e0\u4e3a\u5728\u64cd\u4f5c\u8868\u7684\u65f6\u5019\u8981\u5316\u5927\u91cf\u65f6\u95f4\u82b1\u5728\u521b\u5efa\u7d22\u5f15\u4e2d<\/p>\n\n\n\n<p>\u5982\u679c\u4ece\u8868\u4e2d\u5220\u9664\u4e86\u67d0\u5217\uff0c\u5219\u7d22\u5f15\u4f1a\u53d7\u5230\u5f71\u54cd\u3002\u5bf9\u4e8e\u591a\u5217\u7ec4\u5408\u7684\u7d22\u5f15\uff0c\u5982\u679c\u5220\u9664\u5176\u4e2d\u7684\u67d0\u5217\uff0c\u5219\u8be5\u5217\u4e5f\u4f1a\u4ece\u7d22\u5f15\u4e2d\u5220\u9664\u3002\u5982\u679c\u5220\u9664\u7ec4\u6210\u7d22\u5f15\u7684\u6240\u6709\u5217\uff0c\u5219\u6574\u4e2a\u7d22\u5f15\u5c06\u88ab\u5220\u9664\u3002<\/p>\n\n\n\n<p><strong>\u7d22\u5f15\u9002\u7528\u573a\u666f<\/strong>\uff1a<\/p>\n\n\n\n<p>\u30001\u3001\u7d22\u5f15\u5e94\u8be5\u7ecf\u5e38\u5efa\u5728Where \u5b50\u53e5\u7ecf\u5e38\u7528\u5230\u7684\u5217\u4e0a\u3002\u5982\u679c\u67d0\u4e2a\u5927\u8868\u7ecf\u5e38\u4f7f\u7528\u67d0\u4e2a\u5b57\u6bb5\u8fdb\u884c\u67e5\u8be2\uff0c\u5e76\u4e14\u68c0\u7d22\u884c\u6570\u5c0f\u4e8e\u603b\u8868\u884c\u6570\u76845%\u3002\u5219\u5e94\u8be5\u8003\u8651\u3002<\/p>\n\n\n\n<p>\u30002\u3001\u5bf9\u4e8e\u4e24\u8868\u8fde\u63a5\u7684\u5b57\u6bb5\uff0c\u5e94\u8be5\u5efa\u7acb\u7d22\u5f15\u3002\u5982\u679c\u7ecf\u5e38\u5728\u67d0\u8868\u7684\u4e00\u4e2a\u5b57\u6bb5\u8fdb\u884cOrder By \u5219\u4e5f\u7ecf\u8fc7\u8fdb\u884c\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u30003\u3001\u4e0d\u5e94\u8be5\u5728\u5c0f\u8868\u4e0a\u5efa\u8bbe\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u30004.\u5982\u679cwhere\u5b50\u53e5\u4e2d\u5df2\u7ecf\u4f7f\u7528\u4e86\u7d22\u5f15\u7684\u8bdd\uff0c\u90a3\u4e48order by\u4e2d\u7684\u5217\u662f\u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u7684\u3002\u56e0\u6b64\u6570\u636e\u5e93\u9ed8\u8ba4\u6392\u5e8f\u53ef\u4ee5\u7b26\u5408\u8981\u6c42\u7684\u60c5\u51b5\u4e0b\u4e0d\u8981\u4f7f\u7528\u6392\u5e8f\u64cd\u4f5c\uff1b\u5c3d\u91cf\u4e0d\u8981\u5305\u542b\u591a\u4e2a\u5217\u7684\u6392\u5e8f\uff0c\u5982\u679c\u9700\u8981\u6700\u597d\u7ed9\u8fd9\u4e9b\u5217\u521b\u5efa\u590d\u5408\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u30005.like\u8bed\u53e5\u64cd\u4f5c<\/p>\n\n\n\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\u4e0d\u9f13\u52b1\u4f7f\u7528like\u64cd\u4f5c\uff0c\u5982\u679c\u975e\u4f7f\u7528\u4e0d\u53ef\uff0c\u5982\u4f55\u4f7f\u7528\u4e5f\u662f\u4e00\u4e2a\u95ee\u9898\u3002like \u201c%aaa%\u201d \u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u800clike \u201caaa%\u201d\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>&nbsp; 6.\u4e0d\u8981\u5728\u5217\u4e0a\u8fdb\u884c\u8fd0\u7b97<\/p>\n\n\n\n<p>select * from users where<\/p>\n\n\n\n<p>YEAR(adddate)<\/p>\n\n\n\n<p><strong>&nbsp;7.<\/strong>\u4e0d\u4f7f\u7528NOT IN\u548cor\u64cd\u4f5c<\/p>\n\n\n\n<p>NOT IN\u548c\u64cd\u4f5c\u90fd\u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u5c06\u8fdb\u884c\u5168\u8868\u626b\u63cf\u3002NOT IN\u53ef\u4ee5NOT EXISTS\u4ee3\u66ff\uff0cid3\u5219\u53ef\u4f7f\u7528id&gt;3 or id<\/p>\n\n\n\n<p>\u7d22\u5f15\u9002\u7528\u573a\u666f\uff1a<\/p>\n\n\n\n<p>\u30001\u3001\u7d22\u5f15\u5e94\u8be5\u7ecf\u5e38\u5efa\u5728Where \u5b50\u53e5\u7ecf\u5e38\u7528\u5230\u7684\u5217\u4e0a\u3002\u5982\u679c\u67d0\u4e2a\u5927\u8868\u7ecf\u5e38\u4f7f\u7528\u67d0\u4e2a\u5b57\u6bb5\u8fdb\u884c\u67e5\u8be2\uff0c\u5e76\u4e14\u68c0\u7d22\u884c\u6570\u5c0f\u4e8e\u603b\u8868\u884c\u6570\u76845%\u3002\u5219\u5e94\u8be5\u8003\u8651\u3002<\/p>\n\n\n\n<p>\u30002\u3001\u5bf9\u4e8e\u4e24\u8868\u8fde\u63a5\u7684\u5b57\u6bb5\uff0c\u5e94\u8be5\u5efa\u7acb\u7d22\u5f15\u3002\u5982\u679c\u7ecf\u5e38\u5728\u67d0\u8868\u7684\u4e00\u4e2a\u5b57\u6bb5\u8fdb\u884cOrder By \u5219\u4e5f\u7ecf\u8fc7\u8fdb\u884c\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u30003\u3001\u4e0d\u5e94\u8be5\u5728\u5c0f\u8868\u4e0a\u5efa\u8bbe\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>\u5982\u679cwhere\u5b50\u53e5\u4e2d\u5df2\u7ecf\u4f7f\u7528\u4e86\u7d22\u5f15\u7684\u8bdd\uff0c\u90a3\u4e48order by\u4e2d\u7684\u5217\u662f\u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u7684\u3002\u56e0\u6b64\u6570\u636e\u5e93\u9ed8\u8ba4\u6392\u5e8f\u53ef\u4ee5\u7b26\u5408\u8981\u6c42\u7684\u60c5\u51b5\u4e0b\u4e0d\u8981\u4f7f\u7528\u6392\u5e8f\u64cd\u4f5c\uff1b\u5c3d\u91cf\u4e0d\u8981\u5305\u542b\u591a\u4e2a\u5217\u7684\u6392\u5e8f\uff0c\u5982\u679c\u9700\u8981\u6700\u597d\u7ed9\u8fd9\u4e9b\u5217\u521b\u5efa\u590d\u5408\u7d22\u5f15\u3002<\/p>\n\n\n\n<p>like\u8bed\u53e5\u64cd\u4f5c<\/p>\n\n\n\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\u4e0d\u9f13\u52b1\u4f7f\u7528like\u64cd\u4f5c\uff0c\u5982\u679c\u975e\u4f7f\u7528\u4e0d\u53ef\uff0c\u5982\u4f55\u4f7f\u7528\u4e5f\u662f\u4e00\u4e2a\u95ee\u9898\u3002like \u201c%aaa%\u201d \u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u800clike \u201caaa%\u201d\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u3002<\/p>\n\n\n\n<p><strong>\u4e0d\u8981\u5728\u5217\u4e0a\u8fdb\u884c\u8fd0\u7b97<\/strong><\/p>\n\n\n\n<p>select * from users where<\/p>\n\n\n\n<p>YEAR(adddate)<\/p>\n\n\n\n<p><strong>\u4e0d\u4f7f\u7528<\/strong><strong>NOT IN<\/strong><strong>\u548c\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<p>NOT IN\u548c\u64cd\u4f5c\u90fd\u4e0d\u4f1a\u4f7f\u7528\u7d22\u5f15\u5c06\u8fdb\u884c\u5168\u8868\u626b\u63cf\u3002NOT IN\u53ef\u4ee5NOT EXISTS\u4ee3\u66ff\uff0cid3\u5219\u53ef\u4f7f\u7528id&gt;3 or id<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d22\u5f15\uff1a \u5728\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\uff0c\u7d22\u5f15\u662f\u4e00&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":324,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media\/324"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}