{"id":6335,"date":"2024-11-14T14:46:30","date_gmt":"2024-11-14T06:46:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6335\/"},"modified":"2024-11-14T14:46:30","modified_gmt":"2024-11-14T06:46:30","slug":"mysql%e5%b8%b8%e7%94%a8%e8%af%ad%e5%8f%a5%e6%9c%89%e5%a4%9a%e5%b0%91%e6%9d%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6335\/","title":{"rendered":"mysql\u5e38\u7528\u8bed\u53e5\u6709\u591a\u5c11\u6761"},"content":{"rendered":"<blockquote><p>\n  mysql \u5e38\u7528\u8bed\u53e5\u5305\u62ec\uff1a\u6570\u636e\u64cd\u4f5c\u8bed\u8a00 (dml)\uff1aselect\u3001insert\u3001update\u3001delete\u6570\u636e\u5b9a\u4e49\u8bed\u8a00 (ddl)\uff1acreate table\u3001alter table\u3001drop table\u6570\u636e\u63a7\u5236\u8bed\u8a00 (dcl)\uff1agrant\u3001revoke\u4e8b\u52a1\u63a7\u5236\u8bed\u53e5\uff1abegin\u3001commit\u3001rollback\u6570\u636e\u67e5\u8be2\u8bed\u8a00 (dql)\uff1awhere\u3001order by\u3001group by\u3001join\u6570\u636e\u7c7b\u578b\u8f6c\u6362\uff1acast\u3001convert\u5176\u4ed6\u5e38\u7528\u8bed\u53e5\uff1ashow tables\u3001describe\u3001explain\u3001\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202407\/31\/2024073122525245574.jpg\" class=\"aligncenter\" title=\"mysql\u5e38\u7528\u8bed\u53e5\u6709\u591a\u5c11\u6761\u63d2\u56fe\" alt=\"mysql\u5e38\u7528\u8bed\u53e5\u6709\u591a\u5c11\u6761\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u5e38\u7528\u8bed\u53e5<\/strong><\/p>\n<p>MySQL \u662f\u4e00\u79cd\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u8bed\u53e5\u6765\u64cd\u4f5c\u548c\u7ba1\u7406\u6570\u636e\u3002\u5176\u5e38\u7528\u8bed\u53e5\u5982\u4e0b\uff1a<\/p>\n<p><strong>1. \u6570\u636e\u64cd\u4f5c\u8bed\u8a00 (DML)<\/strong><\/p>\n<ul>\n<li> <strong>SELECT\uff1a<\/strong>\u68c0\u7d22\u6570\u636e<\/li>\n<li> <strong>INSERT\uff1a<\/strong>\u63d2\u5165\u6570\u636e<\/li>\n<li> <strong>UPDATE\uff1a<\/strong>\u66f4\u65b0\u6570\u636e<\/li>\n<li> <strong>DELETE\uff1a<\/strong>\u5220\u9664\u6570\u636e<\/li>\n<\/ul>\n<p><strong>2. \u6570\u636e\u5b9a\u4e49\u8bed\u8a00 (DDL)<\/strong><\/p>\n<ul>\n<li> <strong>CREATE TABLE\uff1a<\/strong>\u521b\u5efa\u8868<\/li>\n<li> <strong>ALTER TABLE\uff1a<\/strong>\u4fee\u6539\u8868<\/li>\n<li> <strong>DROP TABLE\uff1a<\/strong>\u5220\u9664\u8868<\/li>\n<\/ul>\n<p><strong>3. \u6570\u636e\u63a7\u5236\u8bed\u8a00 (DCL)<\/strong><\/p>\n<ul>\n<li> <strong>GRANT\uff1a<\/strong>\u6388\u4e88\u6743\u9650<\/li>\n<li> <strong>REVOKE\uff1a<\/strong>\u64a4\u6d88\u6743\u9650<\/li>\n<\/ul>\n<p><strong>4. \u4e8b\u52a1\u63a7\u5236\u8bed\u53e5<\/strong><\/p>\n<ul>\n<li> <strong>BEGIN\uff1a<\/strong>\u5f00\u59cb\u4e8b\u52a1<\/li>\n<li> <strong>COMMIT\uff1a<\/strong>\u63d0\u4ea4\u4e8b\u52a1<\/li>\n<li> <strong>ROLLBACK\uff1a<\/strong>\u56de\u6eda\u4e8b\u52a1<\/li>\n<\/ul>\n<p><strong>5. \u6570\u636e\u67e5\u8be2\u8bed\u8a00 (DQL)<\/strong><\/p>\n<ul>\n<li> <strong>WHERE\uff1a<\/strong>\u8fc7\u6ee4\u6570\u636e<\/li>\n<li> <strong>ORDER BY\uff1a<\/strong>\u6392\u5e8f\u6570\u636e<\/li>\n<li> <strong>GROUP BY\uff1a<\/strong>\u5206\u7ec4\u6570\u636e<\/li>\n<li> <strong>JOIN\uff1a<\/strong>\u8fde\u63a5\u8868<\/li>\n<\/ul>\n<p><strong>6. \u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/strong><\/p>\n<ul>\n<li> <strong>CAST\uff1a<\/strong>\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u6307\u5b9a\u7c7b\u578b<\/li>\n<li> <strong>CONVERT\uff1a<\/strong>\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u6307\u5b9a\u7c7b\u578b\uff08\u7c7b\u4f3c\u4e8e CAST\uff09<\/li>\n<\/ul>\n<p><strong>7. \u5176\u4ed6\u5e38\u7528\u8bed\u53e5<\/strong><\/p>\n<ul>\n<li> <strong>SHOW TABLES\uff1a<\/strong>\u663e\u793a\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868<\/li>\n<li> <strong>DESCRIBE\uff1a<\/strong>\u663e\u793a\u8868\u7684\u7ed3\u6784<\/li>\n<li> <strong>EXPLAIN\uff1a<\/strong>\u5206\u6790\u67e5\u8be2\u7684\u6267\u884c\u8ba1\u5212<\/li>\n<li> <strong>TRUNCATE TABLE\uff1a<\/strong>\u6e05\u7a7a\u8868\uff08\u6bd4 DELETE \u66f4\u5feb\uff09<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5e38\u7528\u8bed\u53e5\u6709\u591a\u5c11\u6761\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>mysql \u5e38\u7528\u8bed\u53e5\u5305\u62ec\uff1a\u6570\u636e\u64cd\u4f5c\u8bed\u8a00 (dml)\uff1aselect\u3001insert\u3001update\u3001delete\u6570\u636e\u5b9a\u4e49\u8bed\u8a00 (ddl)\uff1acreate table\u3001alter table\u3001drop table\u6570\u636e\u63a7\u5236\u8bed\u8a00 (dcl)\uff1agrant\u3001revoke\u4e8b\u52a1\u63a7\u5236\u8bed\u53e5\uff1abegin\u3001commit\u3001rollback\u6570\u636e\u67e5\u8be2\u8bed\u8a00 (dql)\uff1awhere\u3001order by\u3001group by\u3001join\u6570\u636e\u7c7b\u578b\u8f6c\u6362\uff1acast\u3001convert\u5176\u4ed6\u5e38\u7528\u8bed\u53e5\uff1ashow tables\u3001describe\u3001explain\u3001 MySQL \u5e38\u7528\u8bed\u53e5 MySQL \u662f\u4e00\u79cd\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u8bed\u53e5\u6765\u64cd\u4f5c\u548c\u7ba1\u7406\u6570\u636e\u3002\u5176\u5e38\u7528\u8bed\u53e5\u5982\u4e0b\uff1a 1. \u6570\u636e\u64cd\u4f5c\u8bed\u8a00 (DML) SELECT\uff1a\u68c0\u7d22\u6570\u636e INSERT\uff1a\u63d2\u5165\u6570\u636e UPDATE\uff1a\u66f4\u65b0\u6570\u636e DELETE\uff1a\u5220\u9664\u6570\u636e 2. \u6570\u636e\u5b9a\u4e49\u8bed\u8a00 (DDL) CREATE TABLE\uff1a\u521b\u5efa\u8868 ALTER TABLE\uff1a\u4fee\u6539\u8868 DROP TABLE\uff1a\u5220\u9664\u8868 3. \u6570\u636e\u63a7\u5236\u8bed\u8a00 (DCL) GRANT\uff1a\u6388\u4e88\u6743\u9650 REVOKE\uff1a\u64a4\u6d88\u6743\u9650 4. \u4e8b\u52a1\u63a7\u5236\u8bed\u53e5 BEGIN\uff1a\u5f00\u59cb\u4e8b\u52a1 COMMIT\uff1a\u63d0\u4ea4\u4e8b\u52a1 ROLLBACK\uff1a\u56de\u6eda\u4e8b\u52a1 5. \u6570\u636e\u67e5\u8be2\u8bed\u8a00 (DQL) WHERE\uff1a\u8fc7\u6ee4\u6570\u636e ORDER BY\uff1a\u6392\u5e8f\u6570\u636e GROUP BY\uff1a\u5206\u7ec4\u6570\u636e JOIN\uff1a\u8fde\u63a5\u8868 6. \u6570\u636e\u7c7b\u578b\u8f6c\u6362 CAST\uff1a\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u6307\u5b9a\u7c7b\u578b CONVERT\uff1a\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u6307\u5b9a\u7c7b\u578b\uff08\u7c7b\u4f3c\u4e8e [&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-6335","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6335","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=6335"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6335\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}