{"id":232,"date":"2023-02-24T05:52:52","date_gmt":"2023-02-23T21:52:52","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=232"},"modified":"2023-04-30T15:21:51","modified_gmt":"2023-04-30T07:21:51","slug":"difference-between-ddl-and-dml","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/difference-between-ddl-and-dml\/","title":{"rendered":"DDL\u4e0eDML\u7684\u533a\u522b"},"content":{"rendered":"<h2>\u57fa\u672c\u5b9a\u4e49<\/h2>\n<ul>\n<li>DML(Data Manipulation Language) \u6570\u636e\u64cd\u7eb5\u8bed\u8a00<\/li>\n<\/ul>\n<p>\u9002\u7528\u8303\u56f4\uff1a\u5bf9\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u4e00\u4e9b\u7b80\u5355\u64cd\u4f5c\uff0c\u5982<code>insert<\/code>,<code>delete<\/code>,<code>update<\/code>,<code>select<\/code>\u7b49<\/p>\n<p><!-- more --><\/p>\n<ul>\n<li>DDL(Data Definition Language) \u6570\u636e\u5b9a\u4e49\u8bed\u8a00<\/li>\n<\/ul>\n<p>\u9002\u7528\u8303\u56f4\uff1a\u5bf9\u6570\u636e\u5e93\u4e2d\u7684\u67d0\u4e9b\u5bf9\u8c61(\u4f8b\u5982<code>database<\/code>,<code>table<\/code>)\u8fdb\u884c\u7ba1\u7406\uff0c\u5982<code>create<\/code>,<code>alter<\/code>\u548c<code>drop<\/code><\/p>\n<h2>DDL(\u6570\u636e\u5b9a\u4e49\u8bed\u8a00, Data Definition Language)<\/h2>\n<p>\u5efa\u5e93\u3001\u5efa\u8868\u3001\u8bbe\u7f6e\u7ea6\u675f\u7b49\uff1a<code>create\\drop\\alter<\/code><\/p>\n<p>1\u3001\u521b\u5efa\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-sql\">create database if not exists appblog character set utf8;<\/code><\/pre>\n<p>2\u3001\u521b\u5efa\u8868<\/p>\n<pre><code class=\"language-sql\">use appblog;\ncreate table if not exists stud(\nid int,\nname varchar(30),\nage int\n);<\/code><\/pre>\n<p>3\u3001\u66f4\u6539\u8868\u7ed3\u6784(\u8bbe\u7f6e\u7ea6\u675f)<\/p>\n<pre><code class=\"language-sql\">desc stud; \/\/\u67e5\u770b\u8868\u7ed3\u6784\nalter table stud drop column age;\nalter table stud add column age int;<\/code><\/pre>\n<p>4\u3001\u5220\u9664\u8868\u3001\u5220\u9664\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-sql\">drop table stud;\ndrop database appblog;<\/code><\/pre>\n<h2>DML (\u6570\u636e\u64cd\u7eb5\u8bed\u8a00, Data Manipulation Language )<\/h2>\n<p>\u4e3b\u8981\u6307\u6570\u636e\u7684\u589e\u5220\u67e5\u6539: <code>select\\delete\\update\\insert<\/code><\/p>\n<pre><code class=\"language-sql\">select * from stud;\nselect name,age from stud; \/\/\u67e5\u8be2\u6307\u5b9a\u7684\u5217\nselect name as \u59d3\u540d, age as \u5e74\u9f84 from stud;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u672c\u5b9a\u4e49 DML(Data Manipulation Language) \u6570\u636e\u64cd\u7eb5\u8bed\u8a00 \u9002\u7528\u8303\u56f4\uff1a\u5bf9\u6570\u636e\u5e93\u4e2d\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}