{"id":50675,"date":"2025-08-10T11:38:25","date_gmt":"2025-08-10T03:38:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/50675.html"},"modified":"2025-08-10T11:38:25","modified_gmt":"2025-08-10T03:38:25","slug":"sql%e5%9f%ba%e7%a1%80%e2%91%a7-%e8%a1%a8%e6%a0%bc%e7%af%87","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/50675.html","title":{"rendered":"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7"},"content":{"rendered":"<h2>0 \u5e8f\u8a00<\/h2>\n<p>\u672c\u6587\u56f4\u7ed5MySQL\u4e2d\u8868\u7684\u521b\u5efa\u4e0e\u7ba1\u7406\u5c55\u5f00&#xff0c;\u6db5\u76d6\u6570\u636e\u5b58\u50a8\u8fc7\u7a0b\u3001\u547d\u540d\u89c4\u5219\u3001\u6570\u636e\u7c7b\u578b&#xff0c;\u4ee5\u53ca\u6570\u636e\u5e93\u548c\u8868\u7684\u521b\u5efa\u3001\u4fee\u6539\u3001\u5220\u9664\u7b49\u64cd\u4f5c\u3002<\/p>\n<p>\u901a\u8fc7\u5b66\u4e60&#xff0c;\u4f60\u5c06\u638c\u63e1\u6570\u636e\u5e93\u4e0e\u8868\u7684\u6838\u5fc3\u64cd\u4f5c\u65b9\u6cd5\u3001\u89c4\u8303\u53ca\u6ce8\u610f\u4e8b\u9879&#xff0c;\u80fd\u6b63\u786e\u6267\u884c\u5404\u7c7b\u76f8\u5173\u64cd\u4f5c\u3002<\/p>\n<h2>1 \u57fa\u7840\u77e5\u8bc6<\/h2>\n<h3>1.1 \u4e00\u6761\u6570\u636e\u5b58\u50a8\u7684\u8fc7\u7a0b<\/h3>\n<h4>1.1.1 \u5b58\u50a8\u7684\u91cd\u8981\u6027<\/h4>\n<p>\u5b58\u50a8\u6570\u636e\u662f\u5904\u7406\u6570\u636e\u7684\u57fa\u7840&#xff0c;\u53ea\u6709\u6b63\u786e\u5b58\u50a8&#xff0c;\u624d\u80fd\u8fdb\u884c\u6709\u6548\u5904\u7406\u548c\u5206\u6790&#xff0c;\u5426\u5219\u6570\u636e\u4f1a\u6742\u4e71\u65e0\u7ae0\u3002<\/p>\n<h4>1.1.2 \u6570\u636e\u5b58\u50a8\u7684\u56db\u6b65\u8fc7\u7a0b<\/h4>\n<p>\u5728MySQL\u4e2d&#xff0c;\u5b8c\u6574\u7684\u6570\u636e\u5b58\u50a8\u8fc7\u7a0b\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u521b\u5efa\u6570\u636e\u5e93<\/li>\n<li>\u786e\u8ba4\u5b57\u6bb5<\/li>\n<li>\u521b\u5efa\u6570\u636e\u8868<\/li>\n<li>\u63d2\u5165\u6570\u636e<\/li>\n<\/ul>\n<h4>1.1.3 \u5148\u521b\u5efa\u6570\u636e\u5e93\u7684\u539f\u56e0<\/h4>\n<p>\u4ece\u7cfb\u7edf\u67b6\u6784\u5c42\u6b21\u770b&#xff0c;MySQL\u6570\u636e\u5e93\u7cfb\u7edf\u4ece\u5927\u5230\u5c0f\u4f9d\u6b21\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\u3001\u6570\u636e\u5e93\u3001\u6570\u636e\u8868\u3001\u6570\u636e\u8868\u7684\u884c\u4e0e\u5217\u3002\u7531\u4e8eMySQL\u670d\u52a1\u5668\u5df2\u5b89\u88c5&#xff0c;\u6545\u4ece\u521b\u5efa\u6570\u636e\u5e93\u5f00\u59cb\u3002<\/p>\n<h3>1.2 \u6807\u8bc6\u7b26\u547d\u540d\u89c4\u5219<\/h3>\n<h4>1.2.1 \u957f\u5ea6\u9650\u5236<\/h4>\n<ul>\n<li>\u6570\u636e\u5e93\u540d\u3001\u8868\u540d\u4e0d\u8d85\u8fc730\u4e2a\u5b57\u7b26<\/li>\n<li>\u53d8\u91cf\u540d\u9650\u5236\u4e3a29\u4e2a\u5b57\u7b26<\/li>\n<\/ul>\n<h4>1.2.2 \u5b57\u7b26\u9650\u5236<\/h4>\n<p>\u53ea\u80fd\u5305\u542bA\u2013Z\u3001a\u2013z\u30010\u20139\u3001_\u517163\u4e2a\u5b57\u7b26<\/p>\n<h4>1.2.3 \u7a7a\u683c\u9650\u5236<\/h4>\n<p>\u6570\u636e\u5e93\u540d\u3001\u8868\u540d\u3001\u5b57\u6bb5\u540d\u7b49\u5bf9\u8c61\u540d\u4e2d\u95f4\u4e0d\u5305\u542b\u7a7a\u683c<\/p>\n<h4>1.2.4 \u552f\u4e00\u6027\u9650\u5236<\/h4>\n<ul>\n<li>\u540c\u4e00MySQL\u8f6f\u4ef6\u4e2d&#xff0c;\u6570\u636e\u5e93\u4e0d\u80fd\u540c\u540d<\/li>\n<li>\u540c\u4e00\u5e93\u4e2d&#xff0c;\u8868\u4e0d\u80fd\u91cd\u540d<\/li>\n<li>\u540c\u4e00\u8868\u4e2d&#xff0c;\u5b57\u6bb5\u4e0d\u80fd\u91cd\u540d<\/li>\n<\/ul>\n<h4>1.2.5 \u4e0e\u4fdd\u7559\u5b57\u51b2\u7a81\u5904\u7406<\/h4>\n<p>\u5b57\u6bb5\u540d\u4e0d\u80fd\u548c\u4fdd\u7559\u5b57\u3001\u6570\u636e\u5e93\u7cfb\u7edf\u6216\u5e38\u7528\u65b9\u6cd5\u51b2\u7a81\u3002\u82e5\u575a\u6301\u4f7f\u7528&#xff0c;\u5728SQL\u8bed\u53e5\u4e2d\u7528&#096;&#xff08;\u7740\u91cd\u53f7&#xff09;\u5f15\u8d77\u6765<\/p>\n<h4>1.2.6 \u4e00\u81f4\u6027\u8981\u6c42<\/h4>\n<p>\u4fdd\u6301\u5b57\u6bb5\u540d\u548c\u7c7b\u578b\u7684\u4e00\u81f4\u6027&#xff0c;\u5982\u4e00\u4e2a\u8868\u4e2d\u4e3a\u6574\u6570\u7c7b\u578b&#xff0c;\u5176\u4ed6\u8868\u4e2d\u4e0d\u5e94\u53d8\u4e3a\u5b57\u7b26\u578b<\/p>\n<h3>1.3 MySQL\u4e2d\u7684\u6570\u636e\u7c7b\u578b<\/h3>\n<h4>1.3.1 \u5404\u7c7b\u6570\u636e\u7c7b\u578b<\/h4>\n<ul>\n<li>\u6574\u6570\u7c7b\u578b&#xff1a;TINYINT\u3001SMALLINT\u3001MEDIUMINT\u3001INT(\u6216INTEGER)\u3001BIGINT<\/li>\n<li>\u6d6e\u70b9\u7c7b\u578b&#xff1a;FLOAT\u3001DOUBLE<\/li>\n<li>\u5b9a\u70b9\u6570\u7c7b\u578b&#xff1a;DECIMAL<\/li>\n<li>\u4f4d\u7c7b\u578b&#xff1a;BIT<\/li>\n<li>\u65e5\u671f\u65f6\u95f4\u7c7b\u578b&#xff1a;YEAR\u3001TIME\u3001DATE\u3001DATETIME\u3001TIMESTAMP<\/li>\n<li>\u6587\u672c\u5b57\u7b26\u4e32\u7c7b\u578b&#xff1a;CHAR\u3001VARCHAR\u3001TINYTEXT\u3001TEXT\u3001MEDIUMTEXT\u3001LONGTEXT<\/li>\n<li>\u679a\u4e3e\u7c7b\u578b&#xff1a;ENUM<\/li>\n<li>\u96c6\u5408\u7c7b\u578b&#xff1a;SET<\/li>\n<li>\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\u7c7b\u578b&#xff1a;BINARY\u3001VARBINARY\u3001TINYBLOB\u3001BLOB\u3001MEDIUMBLOB\u3001LONGBLOB<\/li>\n<li>JSON\u7c7b\u578b&#xff1a;JSON\u5bf9\u8c61\u3001JSON\u6570\u7ec4<\/li>\n<li>\u7a7a\u95f4\u6570\u636e\u7c7b\u578b&#xff1a;\u5355\u503c&#xff08;GEOMETRY\u3001POINT\u3001LINESTRING\u3001POLYGON&#xff09;&#xff1b;\u96c6\u5408&#xff08;MULTIPOINT\u3001MULTILINESTRING\u3001MULTIPOLYGON\u3001GEOMETRYCOLLECTION&#xff09;<\/li>\n<\/ul>\n<h4>1.3.2 \u5e38\u7528\u6570\u636e\u7c7b\u578b\u63cf\u8ff0<\/h4>\n<table>\n<tr>\u6570\u636e\u7c7b\u578b\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>INT<\/td>\n<td>\u4ece-2<sup>31\u52302<\/sup>31-1\u7684\u6574\u578b\u6570\u636e&#xff0c;\u5b58\u50a8\u5927\u5c0f\u4e3a4\u4e2a\u5b57\u8282<\/td>\n<\/tr>\n<tr>\n<td>CHAR(size)<\/td>\n<td>\u5b9a\u957f\u5b57\u7b26\u6570\u636e&#xff0c;\u82e5\u672a\u6307\u5b9a&#xff0c;\u9ed8\u8ba4\u4e3a1\u4e2a\u5b57\u7b26&#xff0c;\u6700\u5927\u957f\u5ea6255<\/td>\n<\/tr>\n<tr>\n<td>VARCHAR(size)<\/td>\n<td>\u53ef\u53d8\u957f\u5b57\u7b26\u6570\u636e&#xff0c;\u6839\u636e\u5b57\u7b26\u4e32\u5b9e\u9645\u957f\u5ea6\u4fdd\u5b58&#xff0c;\u5fc5\u987b\u6307\u5b9a\u957f\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>FLOAT(M,D)<\/td>\n<td>\u5355\u7cbe\u5ea6&#xff0c;\u5360\u75284\u4e2a\u5b57\u8282&#xff0c;M&#061;\u6574\u6570\u4f4d&#043;\u5c0f\u6570\u4f4d&#xff0c;D&#061;\u5c0f\u6570\u4f4d\u3002D&lt;&#061;M&lt;&#061;255&#xff0c;0&lt;&#061;D&lt;&#061;30&#xff0c;\u9ed8\u8ba4M&#043;D&lt;&#061;6<\/td>\n<\/tr>\n<tr>\n<td>DOUBLE(M,D)<\/td>\n<td>\u53cc\u7cbe\u5ea6&#xff0c;\u5360\u75288\u4e2a\u5b57\u8282&#xff0c;D&lt;&#061;M&lt;&#061;255&#xff0c;0&lt;&#061;D&lt;&#061;30&#xff0c;\u9ed8\u8ba4M&#043;D&lt;&#061;15<\/td>\n<\/tr>\n<tr>\n<td>DECIMAL(M,D)<\/td>\n<td>\u9ad8\u7cbe\u5ea6\u5c0f\u6570&#xff0c;\u5360\u7528M&#043;2\u4e2a\u5b57\u8282&#xff0c;D&lt;&#061;M&lt;&#061;65&#xff0c;0&lt;&#061;D&lt;&#061;30&#xff0c;\u6700\u5927\u53d6\u503c\u8303\u56f4\u4e0eDOUBLE\u76f8\u540c<\/td>\n<\/tr>\n<tr>\n<td>DATE<\/td>\n<td>\u65e5\u671f\u578b\u6570\u636e&#xff0c;\u683c\u5f0f\u2019YYYY-MM-DD\u2019<\/td>\n<\/tr>\n<tr>\n<td>BLOB<\/td>\n<td>\u4e8c\u8fdb\u5236\u5f62\u5f0f\u7684\u957f\u6587\u672c\u6570\u636e&#xff0c;\u6700\u5927\u53ef\u8fbe4G<\/td>\n<\/tr>\n<tr>\n<td>TEXT<\/td>\n<td>\u957f\u6587\u672c\u6570\u636e&#xff0c;\u6700\u5927\u53ef\u8fbe4G<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2 \u521b\u5efa\u548c\u7ba1\u7406\u6570\u636e\u5e93<\/h2>\n<h3>2.1 \u521b\u5efa\u6570\u636e\u5e93<\/h3>\n<h4>2.1.1 \u521b\u5efa\u65b9\u5f0f<\/h4>\n<ul>\n<li>\u65b9\u5f0f1&#xff1a;\u521b\u5efa\u6570\u636e\u5e93<\/li>\n<\/ul>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<ul>\n<li>\u65b9\u5f0f2&#xff1a;\u521b\u5efa\u6570\u636e\u5e93\u5e76\u6307\u5b9a\u5b57\u7b26\u96c6<\/li>\n<\/ul>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d <span class=\"token keyword\">CHARACTER<\/span> <span class=\"token keyword\">SET<\/span> \u5b57\u7b26\u96c6<span class=\"token punctuation\">;<\/span><\/p>\n<ul>\n<li>\u65b9\u5f0f3&#xff1a;\u5224\u65ad\u6570\u636e\u5e93\u662f\u5426\u5df2\u5b58\u5728&#xff0c;\u4e0d\u5b58\u5728\u5219\u521b\u5efa&#xff08;\u63a8\u8350&#xff09;<\/li>\n<\/ul>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> <span class=\"token keyword\">IF<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token keyword\">EXISTS<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u4f8b\u5982\u8bf4&#xff0c;<\/p>\n<p><span class=\"token comment\">&#8212; \u521b\u5efa\u5e76\u4f7f\u7528\u6570\u636e\u5e93<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> <span class=\"token keyword\">IF<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token keyword\">EXISTS<\/span> demo_hr<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">USE<\/span> demo_hr<span class=\"token punctuation\">;<\/span><\/p>\n<h4>2.1.2 \u6ce8\u610f\u4e8b\u9879<\/h4>\n<p>DATABASE\u4e0d\u80fd\u76f4\u63a5\u6539\u540d&#xff0c;\u4e00\u4e9b\u53ef\u89c6\u5316\u5de5\u5177\u7684\u6539\u540d\u64cd\u4f5c\u5b9e\u9645\u662f\u5efa\u65b0\u5e93\u3001\u590d\u5236\u8868\u3001\u5220\u65e7\u5e93<\/p>\n<h3>2.2 \u4f7f\u7528\u6570\u636e\u5e93<\/h3>\n<h4>2.2.1 \u67e5\u770b\u5f53\u524d\u6240\u6709\u6570\u636e\u5e93<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">DATABASES<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033820-6898142ca4f05.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u80fd\u591f\u76f4\u63a5\u770b\u5230\u5f53\u524d\u7684\u6240\u6709\u6570\u636e\u5e93\u3002<\/p>\n<h4>2.2.2 \u67e5\u770b\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684\u6570\u636e\u5e93<\/h4>\n<p><span class=\"token keyword\">SELECT<\/span> <span class=\"token keyword\">DATABASE<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033821-6898142d7e35b.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>2.2.3 \u67e5\u770b\u6307\u5b9a\u5e93\u4e0b\u6240\u6709\u7684\u8868<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">TABLES<\/span> <span class=\"token keyword\">FROM<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033821-6898142de080e.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>2.2.4 \u67e5\u770b\u6570\u636e\u5e93\u7684\u521b\u5efa\u4fe1\u606f<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6216<\/p>\n<p><span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d\\\\G<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033822-6898142e8c365.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>2.2.5 \u4f7f\u7528\/\u5207\u6362\u6570\u636e\u5e93<\/h4>\n<p><span class=\"token keyword\">USE<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6211\u4eec\u518d\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u4e00\u7cfb\u5217\u64cd\u4f5c\u4e4b\u524d&#xff0c;\u90fd\u9700\u8981\u901a\u8fc7\u8fd9\u4e2a\u8bed\u53e5\u53bb\u9009\u62e9\u4f60\u8981\u7684\u6570\u636e\u5e93&#xff0c;<\/p>\n<p>\u7136\u540e\u624d\u80fd\u6267\u884c\u76f8\u5173\u64cd\u4f5c\u3002<\/p>\n<h4>2.2.6 \u6ce8\u610f\u4e8b\u9879<\/h4>\n<p>\u64cd\u4f5c\u8868\u683c\u548c\u6570\u636e\u524d\u5fc5\u987b\u8bf4\u660e\u5bf9\u54ea\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u5426\u5219\u9700\u5bf9\u6240\u6709\u5bf9\u8c61\u52a0\u6570\u636e\u5e93\u540d.<\/p>\n<h3>2.3 \u4fee\u6539\u6570\u636e\u5e93<\/h3>\n<h4>2.3.1 \u66f4\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6<\/h4>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d <span class=\"token keyword\">CHARACTER<\/span> <span class=\"token keyword\">SET<\/span> \u5b57\u7b26\u96c6<span class=\"token punctuation\">;<\/span><\/p>\n<p>&#xff08;\u4f8b\u5982&#xff1a;gbk\u3001utf8\u7b49&#xff09;<\/p>\n<h3>2.4 \u5220\u9664\u6570\u636e\u5e93<\/h3>\n<h4>2.4.1 \u5220\u9664\u65b9\u5f0f<\/h4>\n<ul>\n<li>\u65b9\u5f0f1&#xff1a;\u5220\u9664\u6307\u5b9a\u7684\u6570\u636e\u5e93<\/li>\n<\/ul>\n<p><span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">DATABASE<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<ul>\n<li>\u65b9\u5f0f2&#xff1a;\u5220\u9664\u6307\u5b9a\u7684\u6570\u636e\u5e93&#xff08;\u63a8\u8350&#xff09;<\/li>\n<\/ul>\n<p><span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">DATABASE<\/span> <span class=\"token keyword\">IF<\/span> <span class=\"token keyword\">EXISTS<\/span> \u6570\u636e\u5e93\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<h2>3 \u521b\u5efa\u8868<\/h2>\n<h3>3.1 \u521b\u5efa\u65b9\u5f0f1<\/h3>\n<h4>3.1.1 \u5fc5\u5907\u6761\u4ef6<\/h4>\n<ul>\n<li>\u5177\u6709CREATE TABLE\u6743\u9650<\/li>\n<li>\u6709\u5b58\u50a8\u7a7a\u95f4<\/li>\n<\/ul>\n<h4>3.1.2 \u8bed\u6cd5\u683c\u5f0f<\/h4>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token keyword\">IF<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token keyword\">EXISTS<\/span><span class=\"token punctuation\">]<\/span> \u8868\u540d<span class=\"token punctuation\">(<\/span><br \/>\n\u5b57\u6bb5<span class=\"token number\">1<\/span> \u6570\u636e\u7c7b\u578b <span class=\"token punctuation\">[<\/span>\u7ea6\u675f\u6761\u4ef6<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">[<\/span>\u9ed8\u8ba4\u503c<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n\u5b57\u6bb5<span class=\"token number\">2<\/span> \u6570\u636e\u7c7b\u578b <span class=\"token punctuation\">[<\/span>\u7ea6\u675f\u6761\u4ef6<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">[<\/span>\u9ed8\u8ba4\u503c<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n\u5b57\u6bb5<span class=\"token number\">3<\/span> \u6570\u636e\u7c7b\u578b <span class=\"token punctuation\">[<\/span>\u7ea6\u675f\u6761\u4ef6<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">[<\/span>\u9ed8\u8ba4\u503c<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>\u8868\u7ea6\u675f\u6761\u4ef6<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u4f8b\u5982&#xff0c;<\/p>\n<p><span class=\"token comment\">&#8212; 1. \u90e8\u95e8\u8868<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> <span class=\"token keyword\">IF<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token keyword\">EXISTS<\/span> departments <span class=\"token punctuation\">(<\/span><br \/>\n    department_id <span class=\"token keyword\">INT<\/span> <span class=\"token keyword\">PRIMARY<\/span> <span class=\"token keyword\">KEY<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    department_name <span class=\"token keyword\">VARCHAR<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">50<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    location_id <span class=\"token keyword\">INT<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>3.1.3 \u5173\u952e\u5b57\u8bf4\u660e<\/h4>\n<ul>\n<li>IF NOT EXISTS&#xff1a;\u82e5\u6570\u636e\u5e93\u4e2d\u4e0d\u5b58\u5728\u8be5\u8868\u5219\u521b\u5efa&#xff0c;\u5b58\u5728\u5219\u5ffd\u7565<\/li>\n<\/ul>\n<h4>3.1.4 \u5fc5\u987b\u6307\u5b9a\u5185\u5bb9<\/h4>\n<ul>\n<li>\u8868\u540d<\/li>\n<li>\u5217\u540d&#xff08;\u6216\u5b57\u6bb5\u540d&#xff09;\u3001\u6570\u636e\u7c7b\u578b\u3001\u957f\u5ea6<\/li>\n<\/ul>\n<h4>3.1.5 \u53ef\u9009\u6307\u5b9a\u5185\u5bb9<\/h4>\n<ul>\n<li>\u7ea6\u675f\u6761\u4ef6<\/li>\n<li>\u9ed8\u8ba4\u503c<\/li>\n<\/ul>\n<h4>3.1.6 \u521b\u5efa\u8868\u4e3e\u4f8b1<\/h4>\n<p><span class=\"token comment\">&#8212; \u521b\u5efa\u8868<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> emp <span class=\"token punctuation\">(<\/span><br \/>\n<span class=\"token comment\">&#8212; int\u7c7b\u578b<\/span><br \/>\nemp_id <span class=\"token keyword\">INT<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token comment\">&#8212; \u6700\u591a\u4fdd\u5b5820\u4e2a\u4e2d\u82f1\u6587\u5b57\u7b26<\/span><br \/>\nemp_name <span class=\"token keyword\">VARCHAR<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">20<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token comment\">&#8212; \u603b\u4f4d\u6570\u4e0d\u8d85\u8fc715\u4f4d<\/span><br \/>\nsalary <span class=\"token keyword\">DOUBLE<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token comment\">&#8212; \u65e5\u671f\u7c7b\u578b<\/span><br \/>\nbirthday <span class=\"token keyword\">DATE<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">DESC<\/span> emp<span class=\"token punctuation\">;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033823-6898142f2b699.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>3.1.7 \u8bf4\u660e<\/h4>\n<p>MySQL\u4e2dINT\u7c7b\u578b\u9ed8\u8ba4\u663e\u793a\u5bbd\u5ea6\u4e3a11&#xff0c;\u4e5f\u53ef\u521b\u5efa\u65f6\u6307\u5b9a&#xff0c;\u4f46MySQL 8.x\u7248\u672c\u4e0d\u63a8\u8350\u4e3aINT\u7c7b\u578b\u6307\u5b9a\u663e\u793a\u957f\u5ea6&#xff0c;\u672a\u6765\u53ef\u80fd\u4f1a\u53bb\u6389\u8be5\u8bed\u6cd5\u3002<\/p>\n<h3>3.2 \u521b\u5efa\u65b9\u5f0f2<\/h3>\n<h4>3.2.1 \u8bed\u6cd5<\/h4>\n<p>\u4f7f\u7528AS subquery\u9009\u9879&#xff0c;\u5c06\u521b\u5efa\u8868\u548c\u63d2\u5165\u6570\u636e\u7ed3\u5408<\/p>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> <span class=\"token keyword\">table<\/span> <span class=\"token keyword\">AS<\/span> subquery <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">column<\/span><span class=\"token punctuation\">,<\/span><span class=\"token keyword\">column<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>3.2.2 \u8bf4\u660e<\/h4>\n<ul>\n<li>\u6307\u5b9a\u7684\u5217\u548c\u5b50\u67e5\u8be2\u4e2d\u7684\u5217\u8981\u4e00\u4e00\u5bf9\u5e94<\/li>\n<li>\u53ef\u901a\u8fc7\u5217\u540d\u548c\u9ed8\u8ba4\u503c\u5b9a\u4e49\u5217<\/li>\n<\/ul>\n<h4>3.2.3 \u4e3e\u4f8b<\/h4>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> emp1 <span class=\"token keyword\">AS<\/span> <span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> employees<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> emp2 <span class=\"token keyword\">AS<\/span> <span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> employees <span class=\"token keyword\">WHERE<\/span> <span class=\"token number\">1<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">&#8212; \u521b\u5efa\u7684emp2\u662f\u7a7a\u8868<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<br \/>\n<span class=\"token keyword\">AS<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> employee_id<span class=\"token punctuation\">,<\/span> last_name<span class=\"token punctuation\">,<\/span> salary<span class=\"token operator\">*<\/span><span class=\"token number\">12<\/span> ANNSAL<span class=\"token punctuation\">,<\/span> hire_date<br \/>\n<span class=\"token keyword\">FROM<\/span> employees<br \/>\n<span class=\"token keyword\">WHERE<\/span> department_id <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">80<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">DESCRIBE<\/span> dept80<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u4e2a\u7a0b\u5e8f\u4ec0\u4e48\u610f\u601d\u5462&#xff1f;<br \/>\n\u770b\u4e0b\u9762\u56fe\u7247\u5206\u6790\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033823-6898142f802d4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>3.3 \u67e5\u770b\u6570\u636e\u8868\u7ed3\u6784<\/h3>\n<h4>3.3.1 \u67e5\u770b\u65b9\u5f0f<\/h4>\n<ul>\n<li>\u4f7f\u7528DESCRIBE\/DESC\u8bed\u53e5<\/li>\n<li>\u4f7f\u7528SHOW CREATE TABLE\u8bed\u53e5&#xff0c;\u8bed\u6cd5&#xff1a;<\/li>\n<\/ul>\n<p><span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d\\\\G<\/p>\n<h4>3.3.2 \u8bf4\u660e<\/h4>\n<p>SHOW CREATE TABLE\u8bed\u53e5\u53ef\u67e5\u770b\u8868\u521b\u5efa\u7684\u8be6\u7ec6\u8bed\u53e5\u3001\u5b58\u50a8\u5f15\u64ce\u548c\u5b57\u7b26\u7f16\u7801<\/p>\n<h2>4 \u4fee\u6539\u8868<\/h2>\n<h3>4.1 \u8ffd\u52a0\u4e00\u4e2a\u5217<\/h3>\n<h4>4.1.1 \u8bed\u6cd5\u683c\u5f0f<\/h4>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d <span class=\"token keyword\">ADD<\/span> \u3010<span class=\"token keyword\">COLUMN<\/span>\u3011 \u5b57\u6bb5\u540d \u5b57\u6bb5\u7c7b\u578b \u3010<span class=\"token keyword\">FIRST<\/span><span class=\"token operator\">|<\/span><span class=\"token keyword\">AFTER<\/span> \u5b57\u6bb5\u540d\u3011<span class=\"token punctuation\">;<\/span><\/p>\n<h4>4.1.2 \u4e3e\u4f8b<\/h4>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> dept80 <span class=\"token keyword\">ADD<\/span> job_id <span class=\"token keyword\">varchar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">15<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033823-6898142fb561f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>4.2 \u4fee\u6539\u4e00\u4e2a\u5217<\/h3>\n<h4>4.2.1 \u53ef\u4fee\u6539\u5185\u5bb9<\/h4>\n<p>\u6570\u636e\u7c7b\u578b\u3001\u957f\u5ea6\u3001\u9ed8\u8ba4\u503c\u548c\u4f4d\u7f6e<\/p>\n<h4>4.2.2 \u8bed\u6cd5\u683c\u5f0f<\/h4>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d <span class=\"token keyword\">MODIFY<\/span> \u3010<span class=\"token keyword\">COLUMN<\/span>\u3011 \u5b57\u6bb5\u540d<span class=\"token number\">1<\/span> \u5b57\u6bb5\u7c7b\u578b \u3010<span class=\"token keyword\">DEFAULT<\/span> \u9ed8\u8ba4\u503c\u3011\u3010<span class=\"token keyword\">FIRST<\/span><span class=\"token operator\">|<\/span><span class=\"token keyword\">AFTER<\/span> \u5b57\u6bb5\u540d<span class=\"token number\">2<\/span>\u3011<span class=\"token punctuation\">;<\/span><\/p>\n<h4>4.2.3 \u4e3e\u4f8b<\/h4>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<br \/>\n<span class=\"token keyword\">MODIFY<\/span> last_name <span class=\"token keyword\">VARCHAR<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<br \/>\n<span class=\"token keyword\">MODIFY<\/span> salary <span class=\"token keyword\">double<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">9<\/span><span class=\"token punctuation\">,<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">default<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6ce8\u610f&#xff1a;<\/p>\n<p>\u5bf9\u9ed8\u8ba4\u503c\u7684\u4fee\u6539\u53ea\u5f71\u54cd\u4eca\u540e\u5bf9\u8868\u7684\u4fee\u6539&#xff0c;\u4e5f\u53ef\u901a\u8fc7\u6b64\u65b9\u5f0f\u4fee\u6539\u5217\u7684\u7ea6\u675f<\/p>\n<h3>4.3 \u91cd\u547d\u540d\u4e00\u4e2a\u5217<\/h3>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d CHANGE \u3010<span class=\"token keyword\">column<\/span>\u3011 \u5217\u540d \u65b0\u5217\u540d \u65b0\u6570\u636e\u7c7b\u578b<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<br \/>\nCHANGE department_name dept_name <span class=\"token keyword\">varchar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">15<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd0\u884c\u540e\u628a\u539f\u5b57\u6bb5\u540ddepartment_name\u6539\u6210dept_name\u5e76\u91cd\u7f6e\u5b57\u6bb5\u7c7b\u578b&#xff0c;\u660e\u786e\u6307\u5b9a\u65b0\u7c7b\u578b\u4e3a varchar(15)\u3002<\/p>\n<h3>4.4 \u5220\u9664\u4e00\u4e2a\u5217<\/h3>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d <span class=\"token keyword\">DROP<\/span> \u3010<span class=\"token keyword\">COLUMN<\/span>\u3011\u5b57\u6bb5\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u4f8b\u5982&#xff0c;<\/p>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<br \/>\n<span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">COLUMN<\/span> job_id<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u91cccolumn\u5c31\u662f\u5217\u7684\u610f\u601d\u3002<\/p>\n<h2>5 \u91cd\u547d\u540d\u8868<\/h2>\n<h3>5.1 \u65b9\u5f0f\u4e00<\/h3>\n<p><span class=\"token keyword\">RENAME<\/span> <span class=\"token keyword\">TABLE<\/span> emp <span class=\"token keyword\">TO<\/span> myemp<span class=\"token punctuation\">;<\/span><\/p>\n<h3>5.2 \u65b9\u5f0f\u4e8c<\/h3>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">table<\/span> dept <span class=\"token keyword\">RENAME<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token keyword\">TO<\/span><span class=\"token punctuation\">]<\/span> detail_dept<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">&#8212; [TO]\u53ef\u4ee5\u7701\u7565<\/span><\/p>\n<p>\u8fd9\u91cc\u8981\u6ce8\u610f&#xff1a;<br \/>\n\u5fc5\u987b\u662f\u5bf9\u8c61\u7684\u62e5\u6709\u8005&#xff01;&#xff01;&#xff01;<\/p>\n<h2>6 \u5220\u9664\u8868<\/h2>\n<p>\u5f53\u8868\u672a\u4e0e\u5176\u4ed6\u8868\u5f62\u6210\u5173\u8054\u5173\u7cfb\u65f6\u53ef\u76f4\u63a5\u5220\u9664&#xff0c;\u5220\u9664\u540e\u6570\u636e\u548c\u7ed3\u6784\u90fd\u88ab\u5220\u9664&#xff0c;\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684\u76f8\u5173\u4e8b\u52a1\u88ab\u63d0\u4ea4&#xff0c;\u6240\u6709\u76f8\u5173\u7d22\u5f15\u88ab\u5220\u9664<\/p>\n<p><span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">TABLE<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token keyword\">IF<\/span> <span class=\"token keyword\">EXISTS<\/span><span class=\"token punctuation\">]<\/span> \u6570\u636e\u8868<span class=\"token number\">1<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">,<\/span> \u6570\u636e\u8868<span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> \u2026<span class=\"token punctuation\">,<\/span> \u6570\u636e\u8868n<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>IF EXISTS&#xff1a;\u82e5\u5b58\u5728\u8be5\u8868\u5219\u5220\u9664&#xff0c;\u4e0d\u5b58\u5728\u5219\u5ffd\u7565<\/p>\n<p><span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">TABLE<\/span> dept80<span class=\"token punctuation\">;<\/span><\/p>\n<h2>7 \u6e05\u7a7a\u8868<\/h2>\n<h3>7.1 \u8bed\u6cd5<\/h3>\n<p><span class=\"token keyword\">TRUNCATE<\/span> <span class=\"token keyword\">TABLE<\/span> \u8868\u540d<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5220\u9664\u8868\u4e2d\u6240\u6709\u7684\u6570\u636e&#xff0c;\u91ca\u653e\u8868\u7684\u5b58\u50a8\u7a7a\u95f4!!!<\/p>\n<h3>7.2 \u4e0eDELETE\u5bf9\u6bd4<\/h3>\n<ul>\n<li>TRUNCATE\u8bed\u53e5\u4e0d\u80fd\u56de\u6eda&#xff0c;DELETE\u8bed\u53e5\u5220\u9664\u6570\u636e\u53ef\u4ee5\u56de\u6eda<\/li>\n<li>TRUNCATE TABLE\u6bd4DELETE\u901f\u5ea6\u5feb&#xff0c;\u4f7f\u7528\u7684\u7cfb\u7edf\u548c\u4e8b\u52a1\u65e5\u5fd7\u8d44\u6e90\u5c11&#xff0c;\u4f46\u65e0\u4e8b\u52a1\u4e14\u4e0d\u89e6\u53d1TRIGGER&#xff0c;\u53ef\u80fd\u9020\u6210\u4e8b\u6545&#xff0c;\u4e0d\u5efa\u8bae\u5728\u5f00\u53d1\u4ee3\u7801\u4e2d\u4f7f\u7528<\/li>\n<li>TRUNCATE TABLE\u529f\u80fd\u4e0e\u4e0d\u5e26WHERE\u5b50\u53e5\u7684DELETE\u8bed\u53e5\u76f8\u540c<\/li>\n<\/ul>\n<p><span class=\"token keyword\">TRUNCATE<\/span> <span class=\"token keyword\">TABLE<\/span> detail_dept<span class=\"token punctuation\">;<\/span><\/p>\n<h2>8 \u603b\u7ed3<\/h2>\n<p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86MySQL\u4e2d\u521b\u5efa\u548c\u7ba1\u7406\u8868\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u4ece\u57fa\u7840\u77e5\u8bc6&#xff08;\u6570\u636e\u5b58\u50a8\u8fc7\u7a0b\u3001\u547d\u540d\u89c4\u5219\u3001\u6570\u636e\u7c7b\u578b&#xff09;\u5230\u6570\u636e\u5e93\u7684\u521b\u5efa\u3001\u7ba1\u7406&#xff0c;\u518d\u5230\u8868\u7684\u521b\u5efa\u3001\u4fee\u6539\u3001\u91cd\u547d\u540d\u3001\u5220\u9664\u3001\u6e05\u7a7a\u3002<\/p>\n<p>\u901a\u8fc7\u5b66\u4e60&#xff0c;\u53ef\u4ee5\u638c\u63e1\u6570\u636e\u5e93\u548c\u8868\u7684\u5b8c\u6574\u64cd\u4f5c\u6d41\u7a0b&#xff0c;\u4e86\u89e3\u547d\u540d\u548c\u7c7b\u578b\u9009\u62e9\u7684\u89c4\u8303&#xff0c;\u4ee5\u53ca\u4e0d\u540c\u64cd\u4f5c\u7684\u6ce8\u610f\u4e8b\u9879&#xff0c;\u80fd\u6709\u6548\u8fdb\u884cMySQL\u4e2d\u8868\u7684\u7ba1\u7406\u5de5\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u3010SQL\u57fa\u7840\u7b2c\u516b\u7bc7  \u8d85\u5168\uff01\uff01\uff01\u3011\u672c\u6587\u8bb2\u89e3\u4e86SQL\u8868\u683c\u91cc\u7684\u76f8\u5173\u64cd\u4f5c\uff0c\u5305\u62ec\u6700\u4e3a\u5e38\u89c1\u7684\u5efa\u8868\u3001\u5220\u8868\u3001\u589e\u52a0\u6570\u636e\uff0c\u9002\u5408\u96f6\u57fa\u7840\u60f3\u5feb\u901f\u5165\u95e8SQL\u57fa\u7840\u77e5\u8bc6\u7684\u8bfb\u8005\uff01_sql\u8868\u683c\u6570\u636e<\/p>\n","protected":false},"author":2,"featured_media":50668,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[114,768,4948,371,100,4947],"topic":[],"class_list":["post-50675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-mysql","tag-sql","tag-4948","tag-371","tag-100","tag-4947"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \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\/50675.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u3010SQL\u57fa\u7840\u7b2c\u516b\u7bc7 \u8d85\u5168\uff01\uff01\uff01\u3011\u672c\u6587\u8bb2\u89e3\u4e86SQL\u8868\u683c\u91cc\u7684\u76f8\u5173\u64cd\u4f5c\uff0c\u5305\u62ec\u6700\u4e3a\u5e38\u89c1\u7684\u5efa\u8868\u3001\u5220\u8868\u3001\u589e\u52a0\u6570\u636e\uff0c\u9002\u5408\u96f6\u57fa\u7840\u60f3\u5feb\u901f\u5165\u95e8SQL\u57fa\u7840\u77e5\u8bc6\u7684\u8bfb\u8005\uff01_sql\u8868\u683c\u6570\u636e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/50675.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-10T03:38:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033820-6898142ca4f05.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\/50675.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/50675.html\",\"name\":\"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-10T03:38:25+00:00\",\"dateModified\":\"2025-08-10T03:38:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/50675.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/50675.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50675.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7\"}]},{\"@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\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \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\/50675.html","og_locale":"zh_CN","og_type":"article","og_title":"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u3010SQL\u57fa\u7840\u7b2c\u516b\u7bc7 \u8d85\u5168\uff01\uff01\uff01\u3011\u672c\u6587\u8bb2\u89e3\u4e86SQL\u8868\u683c\u91cc\u7684\u76f8\u5173\u64cd\u4f5c\uff0c\u5305\u62ec\u6700\u4e3a\u5e38\u89c1\u7684\u5efa\u8868\u3001\u5220\u8868\u3001\u589e\u52a0\u6570\u636e\uff0c\u9002\u5408\u96f6\u57fa\u7840\u60f3\u5feb\u901f\u5165\u95e8SQL\u57fa\u7840\u77e5\u8bc6\u7684\u8bfb\u8005\uff01_sql\u8868\u683c\u6570\u636e","og_url":"https:\/\/www.wsisp.com\/helps\/50675.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-10T03:38:25+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810033820-6898142ca4f05.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\/50675.html","url":"https:\/\/www.wsisp.com\/helps\/50675.html","name":"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-10T03:38:25+00:00","dateModified":"2025-08-10T03:38:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/50675.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/50675.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/50675.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SQL\u57fa\u7840\u2467 | \u8868\u683c\u7bc7"}]},{"@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\/50675","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=50675"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50675\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/50668"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=50675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=50675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=50675"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=50675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}