{"id":5917,"date":"2024-11-14T12:32:52","date_gmt":"2024-11-14T04:32:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5917\/"},"modified":"2024-11-14T12:32:52","modified_gmt":"2024-11-14T04:32:52","slug":"sql%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8b%e5%bd%93%e5%89%8d%e6%97%a5%e6%9c%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5917\/","title":{"rendered":"sql\u600e\u4e48\u67e5\u770b\u5f53\u524d\u65e5\u671f"},"content":{"rendered":"<blockquote><p>\n  sql \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f\u7684\u65b9\u6cd5\uff1a\u4f7f\u7528 current_date \u51fd\u6570\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002\u4f7f\u7528 getdate() \u51fd\u6570\uff08\u4ec5\u9650 microsoft sql server\uff09\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002\u4f7f\u7528 now() \u51fd\u6570\uff08\u4ec5\u9650 mysql \u548c mariadb\uff09\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060322213480542.jpg\" class=\"aligncenter\" title=\"sql\u600e\u4e48\u67e5\u770b\u5f53\u524d\u65e5\u671f\u63d2\u56fe\" alt=\"sql\u600e\u4e48\u67e5\u770b\u5f53\u524d\u65e5\u671f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 SQL \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f<\/strong><\/p>\n<p>SQL \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f\u6709\u51e0\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u76f4\u63a5\u4f7f\u7528 CURRENT_DATE \u51fd\u6570\uff1a<\/strong><\/p>\n<pre>SELECT CURRENT_DATE;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u4f7f\u7528 GETDATE() \u51fd\u6570\uff08\u4ec5\u9650 Microsoft SQL Server\uff09\uff1a<\/strong><\/p>\n<pre>SELECT GETDATE();<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u4f7f\u7528 NOW() \u51fd\u6570\uff08\u4ec5\u9650 MySQL \u548c MariaDB\uff09\uff1a<\/strong><\/p>\n<pre>SELECT NOW();<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u90fd\u4f1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\uff0c\u4ee5 YYYY-MM-DD \u683c\u5f0f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f53\u524d\u65e5\u671f\u662f 2023 \u5e74 3 \u6708 8 \u65e5\uff0c\u5219\u67e5\u8be2\u7ed3\u679c\u5c06\u4e3a\uff1a<\/p>\n<pre>2023-03-08<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e0a\u8ff0\u51fd\u6570\u8fd4\u56de\u7684\u662f\u65e5\u671f\u90e8\u5206\uff0c\u4e0d\u5305\u62ec\u65f6\u95f4\u90e8\u5206\u3002<\/li>\n<li>\u4e0d\u540c\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf (DBMS) \u53ef\u80fd\u652f\u6301\u4e0d\u540c\u7684\u51fd\u6570\u3002<\/li>\n<li>\u786e\u4fdd\u5728\u67e5\u8be2\u4e2d\u4f7f\u7528\u6b63\u786e\u7684\u51fd\u6570\uff0c\u4ee5\u5339\u914d\u60a8\u4f7f\u7528\u7684 DBMS\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fsql\u600e\u4e48\u67e5\u770b\u5f53\u524d\u65e5\u671f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>sql \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f\u7684\u65b9\u6cd5\uff1a\u4f7f\u7528 current_date \u51fd\u6570\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002\u4f7f\u7528 getdate() \u51fd\u6570\uff08\u4ec5\u9650 microsoft sql server\uff09\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002\u4f7f\u7528 now() \u51fd\u6570\uff08\u4ec5\u9650 mysql \u548c mariadb\uff09\uff1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\u3002 \u5982\u4f55\u5728 SQL \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f SQL \u4e2d\u67e5\u770b\u5f53\u524d\u65e5\u671f\u6709\u51e0\u79cd\u65b9\u6cd5\uff1a \u76f4\u63a5\u4f7f\u7528 CURRENT_DATE \u51fd\u6570\uff1a SELECT CURRENT_DATE; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 GETDATE() \u51fd\u6570\uff08\u4ec5\u9650 Microsoft SQL Server\uff09\uff1a SELECT GETDATE(); \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 NOW() \u51fd\u6570\uff08\u4ec5\u9650 MySQL \u548c MariaDB\uff09\uff1a SELECT NOW(); \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e9b\u51fd\u6570\u90fd\u4f1a\u8fd4\u56de\u5f53\u524d\u7cfb\u7edf\u65e5\u671f\uff0c\u4ee5 YYYY-MM-DD \u683c\u5f0f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f53\u524d\u65e5\u671f\u662f 2023 \u5e74 3 \u6708 8 \u65e5\uff0c\u5219\u67e5\u8be2\u7ed3\u679c\u5c06\u4e3a\uff1a 2023-03-08 \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5917","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5917"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5917\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}