{"id":543,"date":"2023-05-26T17:44:53","date_gmt":"2023-05-26T09:44:53","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=543"},"modified":"2023-05-28T01:17:48","modified_gmt":"2023-05-27T17:17:48","slug":"%e4%b8%80%e5%8d%83%e8%a1%8c-mysql-%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/mysql\/%e4%b8%80%e5%8d%83%e8%a1%8c-mysql-%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0\/","title":{"rendered":"\u4e00\u5343\u884c MySQL \u5b66\u4e60\u7b14\u8bb0"},"content":{"rendered":"<div class='wxsyncmain'>\n<p style=\"margin-bottom: 0px;outline: 0px;\">Windows\u670d\u52a1<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u542f\u52a8MySQL<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;net <span style=\"outline: 0px;color: rgb(249, 38, 114);\">start<\/span> mysql<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efaWindows\u670d\u52a1<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;sc <span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> mysql binPath= mysqld_bin_path(\u6ce8\u610f\uff1a\u7b49\u53f7\u4e0e\u503c\u4e4b\u95f4\u6709\u7a7a\u683c)<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u8fde\u63a5\u4e0e\u65ad\u5f00\u670d\u52a1\u5668<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">mysql -h \u5730\u5740 -P \u7aef\u53e3 -u \u7528\u6237\u540d -p \u5bc6\u7801<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PROCESSLIST<\/span> <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u54ea\u4e9b\u7ebf\u7a0b\u6b63\u5728\u8fd0\u884c<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VARIABLES<\/span> <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u7cfb\u7edf\u53d8\u91cf\u4fe1\u606f<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u6570\u636e\u5e93\u64cd\u4f5c<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u5f53\u524d\u6570\u636e\u5e93<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASE<\/span>();<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u5f53\u524d\u65f6\u95f4\u3001\u7528\u6237\u540d\u3001\u6570\u636e\u5e93\u7248\u672c<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">now<\/span>(), <span style=\"outline: 0px;color: rgb(249, 38, 114);\">user<\/span>(), <span style=\"outline: 0px;color: rgb(249, 38, 114);\">version<\/span>();<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u5e93<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASE<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NOT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] \u6570\u636e\u5e93\u540d \u6570\u636e\u5e93\u9009\u9879<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6570\u636e\u5e93\u9009\u9879\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(230, 219, 116);\">CHARACTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> charset_name<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLLATE<\/span> collation_name<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u5df2\u6709\u5e93<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASES<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'PATTERN'<\/span>]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u5f53\u524d\u5e93\u4fe1\u606f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASE<\/span> \u6570\u636e\u5e93\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u5e93\u7684\u9009\u9879\u4fe1\u606f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASE<\/span> \u5e93\u540d \u9009\u9879\u4fe1\u606f<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u5e93<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASE<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] \u6570\u636e\u5e93\u540d<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u540c\u65f6\u5220\u9664\u8be5\u6570\u636e\u5e93\u76f8\u5173\u7684\u76ee\u5f55\u53ca\u5176\u76ee\u5f55\u5185\u5bb9<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u8868\u7684\u64cd\u4f5c<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TEMPORARY<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NOT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] [\u5e93\u540d.]\u8868\u540d ( \u8868\u7684\u7ed3\u6784\u5b9a\u4e49 )[ \u8868\u9009\u9879]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6bcf\u4e2a\u5b57\u6bb5\u5fc5\u987b\u6709\u6570\u636e\u7c7b\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5\u540e\u4e0d\u80fd\u6709\u9017\u53f7<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TEMPORARY<\/span> \u4e34\u65f6\u8868\uff0c\u4f1a\u8bdd\u7ed3\u675f\u65f6\u8868\u81ea\u52a8\u6d88\u5931<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5bf9\u4e8e\u5b57\u6bb5\u7684\u5b9a\u4e49\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u5b57\u6bb5\u540d \u6570\u636e\u7c7b\u578b [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">NOT<\/span> <span style=\"outline: 0px;color: rgb(174, 129, 255);\">NULL<\/span> | <span style=\"outline: 0px;color: rgb(174, 129, 255);\">NULL<\/span>] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DEFAULT<\/span> default_value] [AUTO_INCREMENT] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">UNIQUE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span>] | [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIMARY<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span>] [COMMENT <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'string'<\/span>]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8868\u9009\u9879<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b57\u7b26\u96c6<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHARSET<\/span> = charset_name<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5982\u679c\u8868\u6ca1\u6709\u8bbe\u5b9a\uff0c\u5219\u4f7f\u7528\u6570\u636e\u5e93\u5b57\u7b26\u96c6<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b58\u50a8\u5f15\u64ce<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ENGINE<\/span> = engine_name<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u8868\u5728\u7ba1\u7406\u6570\u636e\u65f6\u91c7\u7528\u7684\u4e0d\u540c\u7684\u6570\u636e\u7ed3\u6784\uff0c\u7ed3\u6784\u4e0d\u540c\u4f1a\u5bfc\u81f4\u5904\u7406\u65b9\u5f0f\u3001\u63d0\u4f9b\u7684\u7279\u6027\u64cd\u4f5c\u7b49\u4e0d\u540c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5e38\u89c1\u7684\u5f15\u64ce\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">InnoDB<\/span> MyISAM Memory\/Heap BDB <span style=\"outline: 0px;color: rgb(249, 38, 114);\">Merge<\/span> Example CSV MaxDB Archive<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e0d\u540c\u7684\u5f15\u64ce\u5728\u4fdd\u5b58\u8868\u7684\u7ed3\u6784\u548c\u6570\u636e\u65f6\u91c7\u7528\u4e0d\u540c\u7684\u65b9\u5f0f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;MyISAM\u8868\u6587\u4ef6\u542b\u4e49\uff1a.frm\u8868\u5b9a\u4e49\uff0c.MYD\u8868\u6570\u636e\uff0c.MYI\u8868\u7d22\u5f15<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">InnoDB<\/span>\u8868\u6587\u4ef6\u542b\u4e49\uff1a.frm\u8868\u5b9a\u4e49\uff0c\u8868\u7a7a\u95f4\u6570\u636e\u548c\u65e5\u5fd7\u6587\u4ef6<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ENGINES<\/span> <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u5b58\u50a8\u5f15\u64ce\u7684\u72b6\u6001\u4fe1\u606f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ENGINE<\/span> \u5f15\u64ce\u540d {<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOGS<\/span>|<span style=\"outline: 0px;color: rgb(249, 38, 114);\">STATUS<\/span>} <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u5b58\u50a8\u5f15\u64ce\u7684\u65e5\u5fd7\u6216\u72b6\u6001\u4fe1\u606f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u81ea\u589e\u8d77\u59cb\u6570<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;AUTO_INCREMENT = \u884c\u6570<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6570\u636e\u6587\u4ef6\u76ee\u5f55<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATA<\/span> DIRECTORY = <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u76ee\u5f55'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7d22\u5f15\u6587\u4ef6\u76ee\u5f55<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INDEX<\/span> DIRECTORY = <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u76ee\u5f55'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8868\u6ce8\u91ca<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;COMMENT = <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'string'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5206\u533a\u9009\u9879<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PARTITION<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> ... (\u8be6\u7ec6\u89c1\u624b\u518c)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u6240\u6709\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pattern'<\/span>]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u8868\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u8868\u673a\u6784<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d \uff08\u4fe1\u606f\u66f4\u8be6\u7ec6\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DESC<\/span> \u8868\u540d \/ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DESCRIBE<\/span> \u8868\u540d \/ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXPLAIN<\/span> \u8868\u540d \/ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLUMNS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u8868\u540d [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'PATTERN'<\/span>]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">STATUS<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> db_name] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pattern'<\/span>]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u8868\u672c\u8eab\u7684\u9009\u9879<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d \u8868\u7684\u9009\u9879<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;eg: <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ENGINE<\/span>=MYISAM;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5bf9\u8868\u8fdb\u884c\u91cd\u547d\u540d<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">RENAME<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u539f\u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> \u65b0\u8868\u540d<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">RENAME<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u539f\u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> \u5e93\u540d.\u8868\u540d \uff08\u53ef\u5c06\u8868\u79fb\u52a8\u5230\u53e6\u4e00\u4e2a\u6570\u636e\u5e93\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- RENAME\u53ef\u4ee5\u4ea4\u6362\u4e24\u4e2a\u8868\u540d<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u8868\u7684\u5b57\u6bb5\u673a\u6784\uff0813.1.2. ALTER TABLE\u8bed\u6cd5\uff09<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d \u64cd\u4f5c\u540d<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u64cd\u4f5c\u540d<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ADD<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLUMN<\/span>] \u5b57\u6bb5\u5b9a\u4e49 &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u589e\u52a0\u5b57\u6bb5<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">AFTER<\/span> \u5b57\u6bb5\u540d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8868\u793a\u589e\u52a0\u5728\u8be5\u5b57\u6bb5\u540d\u540e\u9762<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">FIRST<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8868\u793a\u589e\u52a0\u5728\u7b2c\u4e00\u4e2a<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ADD<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIMARY<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span>(\u5b57\u6bb5\u540d) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u4e3b\u952e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ADD<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">UNIQUE<\/span> [\u7d22\u5f15\u540d] (\u5b57\u6bb5\u540d)<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u552f\u4e00\u7d22\u5f15<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ADD<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INDEX<\/span> [\u7d22\u5f15\u540d] (\u5b57\u6bb5\u540d) <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u666e\u901a\u7d22\u5f15<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLUMN<\/span>] \u5b57\u6bb5\u540d &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u5b57\u6bb5<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MODIFY[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLUMN<\/span>] \u5b57\u6bb5\u540d \u5b57\u6bb5\u5c5e\u6027 &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u652f\u6301\u5bf9\u5b57\u6bb5\u5c5e\u6027\u8fdb\u884c\u4fee\u6539\uff0c\u4e0d\u80fd\u4fee\u6539\u5b57\u6bb5\u540d(\u6240\u6709\u539f\u6709\u5c5e\u6027\u4e5f\u9700\u5199\u4e0a)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHANGE<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLUMN<\/span>] \u539f\u5b57\u6bb5\u540d \u65b0\u5b57\u6bb5\u540d \u5b57\u6bb5\u5c5e\u6027 &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u652f\u6301\u5bf9\u5b57\u6bb5\u540d\u4fee\u6539<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIMARY<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u4e3b\u952e(\u5220\u9664\u4e3b\u952e\u524d\u9700\u5220\u9664\u5176AUTO_INCREMENT\u5c5e\u6027)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INDEX<\/span> \u7d22\u5f15\u540d <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u7d22\u5f15<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOREIGN<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span> \u5916\u952e &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u5916\u952e<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span>[ <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] \u8868\u540d ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6e05\u7a7a\u8868\u6570\u636e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRUNCATE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span>] \u8868\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u590d\u5236\u8868\u7ed3\u6784<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> \u8981\u590d\u5236\u7684\u8868\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u590d\u5236\u8868\u7ed3\u6784\u548c\u6570\u636e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">AS<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u8981\u590d\u5236\u7684\u8868\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u68c0\u67e5\u8868\u662f\u5426\u6709\u9519\u8bef<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHECK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ... [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">option<\/span>] ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4f18\u5316\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">OPTIMIZE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCAL<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NO_WRITE_TO_BINLOG<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u590d\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">REPAIR<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCAL<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NO_WRITE_TO_BINLOG<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ... [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">QUICK<\/span>] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXTENDED<\/span>] [USE_FRM]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5206\u6790\u8868<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ANALYZE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCAL<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NO_WRITE_TO_BINLOG<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ...<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u6570\u636e\u64cd\u4f5c<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u589e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span>] \u8868\u540d [(\u5b57\u6bb5\u5217\u8868)] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VALUES<\/span> (\u503c\u5217\u8868)[, (\u503c\u5217\u8868), ...]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5982\u679c\u8981\u63d2\u5165\u7684\u503c\u5217\u8868\u5305\u542b\u6240\u6709\u5b57\u6bb5\u5e76\u4e14\u987a\u5e8f\u4e00\u81f4\uff0c\u5219\u53ef\u4ee5\u7701\u7565\u5b57\u6bb5\u5217\u8868\u3002<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53ef\u540c\u65f6\u63d2\u5165\u591a\u6761\u6570\u636e\u8bb0\u5f55\uff01<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">REPLACE<\/span> \u4e0e <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> \u5b8c\u5168\u4e00\u6837\uff0c\u53ef\u4e92\u6362\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span>] \u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> \u5b57\u6bb5\u540d=\u503c[, \u5b57\u6bb5\u540d=\u503c, ...]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> \u5b57\u6bb5\u5217\u8868 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u8868\u540d[ \u5176\u4ed6\u5b50\u53e5]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53ef\u6765\u81ea\u591a\u4e2a\u8868\u7684\u591a\u4e2a\u5b57\u6bb5<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5176\u4ed6\u5b50\u53e5\u53ef\u4ee5\u4e0d\u4f7f\u7528<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b57\u6bb5\u5217\u8868\u53ef\u4ee5\u7528*\u4ee3\u66ff\uff0c\u8868\u793a\u6240\u6709\u5b57\u6bb5<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DELETE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u8868\u540d[ \u5220\u9664\u6761\u4ef6\u5b50\u53e5]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6ca1\u6709\u6761\u4ef6\u5b50\u53e5\uff0c\u5219\u4f1a\u5220\u9664\u5168\u90e8<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6539<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">UPDATE<\/span> \u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> \u5b57\u6bb5\u540d=\u65b0\u503c[, \u5b57\u6bb5\u540d=\u65b0\u503c] [\u66f4\u65b0\u6761\u4ef6]<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5b57\u7b26\u96c6\u7f16\u7801<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- MySQL\u3001\u6570\u636e\u5e93\u3001\u8868\u3001\u5b57\u6bb5\u5747\u53ef\u8bbe\u7f6e\u7f16\u7801<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6570\u636e\u7f16\u7801\u4e0e\u5ba2\u6237\u7aef\u7f16\u7801\u4e0d\u9700\u4e00\u81f4<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VARIABLES<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'character_set_%'<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u6240\u6709\u5b57\u7b26\u96c6\u7f16\u7801\u9879<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;character_set_client &nbsp; &nbsp; &nbsp; &nbsp;\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u53d1\u9001\u6570\u636e\u65f6\u4f7f\u7528\u7684\u7f16\u7801<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;character_set_results &nbsp; &nbsp; &nbsp; \u670d\u52a1\u5668\u7aef\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u6240\u4f7f\u7528\u7684\u7f16\u7801<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;character_set_connection &nbsp; &nbsp;\u8fde\u63a5\u5c42\u7f16\u7801<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> \u53d8\u91cf\u540d = \u53d8\u91cf\u503c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> character_set_client = gbk;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> character_set_results = gbk;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> character_set_connection = gbk;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NAMES<\/span> GBK; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u76f8\u5f53\u4e8e\u5b8c\u6210\u4ee5\u4e0a\u4e09\u4e2a\u8bbe\u7f6e<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6821\u5bf9\u96c6<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6821\u5bf9\u96c6\u7528\u4ee5\u6392\u5e8f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">CHARACTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pattern'<\/span>]\/<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHARSET<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pattern'<\/span>] &nbsp; \u67e5\u770b\u6240\u6709\u5b57\u7b26\u96c6<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLLATION<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pattern'<\/span>] &nbsp; &nbsp; \u67e5\u770b\u6240\u6709\u6821\u5bf9\u96c6<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHARSET<\/span> \u5b57\u7b26\u96c6\u7f16\u7801 &nbsp; &nbsp; \u8bbe\u7f6e\u5b57\u7b26\u96c6\u7f16\u7801<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">COLLATE<\/span> \u6821\u5bf9\u96c6\u7f16\u7801 &nbsp; &nbsp; \u8bbe\u7f6e\u6821\u5bf9\u96c6\u7f16\u7801<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u6570\u636e\u7c7b\u578b\uff08\u5217\u7c7b\u578b\uff09<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">1. \u6570\u503c\u7c7b\u578b<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- a. \u6574\u578b ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7c7b\u578b &nbsp; &nbsp; &nbsp; &nbsp; \u5b57\u8282 &nbsp; &nbsp; \u8303\u56f4\uff08\u6709\u7b26\u53f7\u4f4d\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;tinyint &nbsp; &nbsp; 1\u5b57\u8282 &nbsp; &nbsp;-128 ~ 127 &nbsp; &nbsp; &nbsp;\u65e0\u7b26\u53f7\u4f4d\uff1a0 ~ 255<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;smallint &nbsp; &nbsp;2\u5b57\u8282 &nbsp; &nbsp;-32768 ~ 32767<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;mediumint &nbsp; 3\u5b57\u8282 &nbsp; &nbsp;-8388608 ~ 8388607<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;int &nbsp; &nbsp; &nbsp; &nbsp; 4\u5b57\u8282<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;bigint &nbsp; &nbsp; &nbsp;8\u5b57\u8282<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;int(M) &nbsp;M\u8868\u793a\u603b\u4f4d\u6570<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u9ed8\u8ba4\u5b58\u5728\u7b26\u53f7\u4f4d\uff0cunsigned \u5c5e\u6027\u4fee\u6539<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u663e\u793a\u5bbd\u5ea6\uff0c\u5982\u679c\u67d0\u4e2a\u6570\u4e0d\u591f\u5b9a\u4e49\u5b57\u6bb5\u65f6\u8bbe\u7f6e\u7684\u4f4d\u6570\uff0c\u5219\u524d\u9762\u4ee50\u8865\u586b\uff0czerofill \u5c5e\u6027\u4fee\u6539<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4f8b\uff1aint(5) &nbsp; \u63d2\u5165\u4e00\u4e2a\u6570'123'\uff0c\u8865\u586b\u540e\u4e3a'00123'<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5728\u6ee1\u8db3\u8981\u6c42\u7684\u60c5\u51b5\u4e0b\uff0c\u8d8a\u5c0f\u8d8a\u597d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- 1\u8868\u793abool\u503c\u771f\uff0c0\u8868\u793abool\u503c\u5047\u3002MySQL\u6ca1\u6709\u5e03\u5c14\u7c7b\u578b\uff0c\u901a\u8fc7\u6574\u578b0\u548c1\u8868\u793a\u3002\u5e38\u7528tinyint(1)\u8868\u793a\u5e03\u5c14\u578b\u3002<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- b. \u6d6e\u70b9\u578b ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7c7b\u578b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5b57\u8282 &nbsp; &nbsp; \u8303\u56f4<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;float(\u5355\u7cbe\u5ea6) &nbsp; &nbsp; 4\u5b57\u8282<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;double(\u53cc\u7cbe\u5ea6) &nbsp; &nbsp;8\u5b57\u8282<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6d6e\u70b9\u578b\u65e2\u652f\u6301\u7b26\u53f7\u4f4d unsigned \u5c5e\u6027\uff0c\u4e5f\u652f\u6301\u663e\u793a\u5bbd\u5ea6 zerofill \u5c5e\u6027\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e0d\u540c\u4e8e\u6574\u578b\uff0c\u524d\u540e\u5747\u4f1a\u8865\u586b0.<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5b9a\u4e49\u6d6e\u70b9\u578b\u65f6\uff0c\u9700\u6307\u5b9a\u603b\u4f4d\u6570\u548c\u5c0f\u6570\u4f4d\u6570\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;float(M, D) &nbsp; &nbsp; double(M, D)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;M\u8868\u793a\u603b\u4f4d\u6570\uff0cD\u8868\u793a\u5c0f\u6570\u4f4d\u6570\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;M\u548cD\u7684\u5927\u5c0f\u4f1a\u51b3\u5b9a\u6d6e\u70b9\u6570\u7684\u8303\u56f4\u3002\u4e0d\u540c\u4e8e\u6574\u578b\u7684\u56fa\u5b9a\u8303\u56f4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;M\u65e2\u8868\u793a\u603b\u4f4d\u6570\uff08\u4e0d\u5305\u62ec\u5c0f\u6570\u70b9\u548c\u6b63\u8d1f\u53f7\uff09\uff0c\u4e5f\u8868\u793a\u663e\u793a\u5bbd\u5ea6\uff08\u6240\u6709\u663e\u793a\u7b26\u53f7\u5747\u5305\u62ec\uff09\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u652f\u6301\u79d1\u5b66\u8ba1\u6570\u6cd5\u8868\u793a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6d6e\u70b9\u6570\u8868\u793a\u8fd1\u4f3c\u503c\u3002<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- c. \u5b9a\u70b9\u6570 ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;decimal <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53ef\u53d8\u957f\u5ea6<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;decimal(M, D) &nbsp; M\u4e5f\u8868\u793a\u603b\u4f4d\u6570\uff0cD\u8868\u793a\u5c0f\u6570\u4f4d\u6570\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4fdd\u5b58\u4e00\u4e2a\u7cbe\u786e\u7684\u6570\u503c\uff0c\u4e0d\u4f1a\u53d1\u751f\u6570\u636e\u7684\u6539\u53d8\uff0c\u4e0d\u540c\u4e8e\u6d6e\u70b9\u6570\u7684\u56db\u820d\u4e94\u5165\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5c06\u6d6e\u70b9\u6570\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u6765\u4fdd\u5b58\uff0c\u6bcf9\u4f4d\u6570\u5b57\u4fdd\u5b58\u4e3a4\u4e2a\u5b57\u8282\u3002<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>2. \u5b57\u7b26\u4e32\u7c7b\u578b<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- a. char, varchar ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;char &nbsp; &nbsp;\u5b9a\u957f\u5b57\u7b26\u4e32\uff0c\u901f\u5ea6\u5feb\uff0c\u4f46\u6d6a\u8d39\u7a7a\u95f4<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;varchar \u53d8\u957f\u5b57\u7b26\u4e32\uff0c\u901f\u5ea6\u6162\uff0c\u4f46\u8282\u7701\u7a7a\u95f4<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;M\u8868\u793a\u80fd\u5b58\u50a8\u7684\u6700\u5927\u957f\u5ea6\uff0c\u6b64\u957f\u5ea6\u662f\u5b57\u7b26\u6570\uff0c\u975e\u5b57\u8282\u6570\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u6240\u5360\u7528\u7684\u7a7a\u95f4\u4e0d\u540c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;char,\u6700\u591a255\u4e2a\u5b57\u7b26\uff0c\u4e0e\u7f16\u7801\u65e0\u5173\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;varchar,\u6700\u591a65535\u5b57\u7b26\uff0c\u4e0e\u7f16\u7801\u6709\u5173\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4e00\u6761\u6709\u6548\u8bb0\u5f55\u6700\u5927\u4e0d\u80fd\u8d85\u8fc765535\u4e2a\u5b57\u8282\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;utf8 \u6700\u5927\u4e3a21844\u4e2a\u5b57\u7b26\uff0cgbk \u6700\u5927\u4e3a32766\u4e2a\u5b57\u7b26\uff0clatin1 \u6700\u5927\u4e3a65532\u4e2a\u5b57\u7b26<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;varchar \u662f\u53d8\u957f\u7684\uff0c\u9700\u8981\u5229\u7528\u5b58\u50a8\u7a7a\u95f4\u4fdd\u5b58 varchar \u7684\u957f\u5ea6\uff0c\u5982\u679c\u6570\u636e\u5c0f\u4e8e255\u4e2a\u5b57\u8282\uff0c\u5219\u91c7\u7528\u4e00\u4e2a\u5b57\u8282\u6765\u4fdd\u5b58\u957f\u5ea6\uff0c\u53cd\u4e4b\u9700\u8981\u4e24\u4e2a\u5b57\u8282\u6765\u4fdd\u5b58\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;varchar \u7684\u6700\u5927\u6709\u6548\u957f\u5ea6\u7531\u6700\u5927\u884c\u5927\u5c0f\u548c\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u786e\u5b9a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6700\u5927\u6709\u6548\u957f\u5ea6\u662f65532\u5b57\u8282\uff0c\u56e0\u4e3a\u5728varchar\u5b58\u5b57\u7b26\u4e32\u65f6\uff0c\u7b2c\u4e00\u4e2a\u5b57\u8282\u662f\u7a7a\u7684\uff0c\u4e0d\u5b58\u5728\u4efb\u4f55\u6570\u636e\uff0c\u7136\u540e\u8fd8\u9700\u4e24\u4e2a\u5b57\u8282\u6765\u5b58\u653e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\uff0c\u6240\u4ee5\u6709\u6548\u957f\u5ea6\u662f64432-1-2=65532\u5b57\u8282\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4f8b\uff1a\u82e5\u4e00\u4e2a\u8868\u5b9a\u4e49\u4e3a <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tb(c1 <span style=\"outline: 0px;color: rgb(230, 219, 116);\">int<\/span>, c2 <span style=\"outline: 0px;color: rgb(230, 219, 116);\">char<\/span>(<span style=\"outline: 0px;color: rgb(174, 129, 255);\">30<\/span>), c3 <span style=\"outline: 0px;color: rgb(230, 219, 116);\">varchar<\/span>(N)) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">charset<\/span>=utf8; \u95eeN\u7684\u6700\u5927\u503c\u662f\u591a\u5c11\uff1f \u7b54\uff1a(65535-1-2-4-30*3)\/3<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- b. blob, text ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;blob \u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff08\u5b57\u8282\u5b57\u7b26\u4e32\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;tinyblob, blob, mediumblob, longblob<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;text \u975e\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff08\u5b57\u7b26\u5b57\u7b26\u4e32\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;tinytext, text, mediumtext, longtext<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;text \u5728\u5b9a\u4e49\u65f6\uff0c\u4e0d\u9700\u8981\u5b9a\u4e49\u957f\u5ea6\uff0c\u4e5f\u4e0d\u4f1a\u8ba1\u7b97\u603b\u957f\u5ea6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;text \u7c7b\u578b\u5728\u5b9a\u4e49\u65f6\uff0c\u4e0d\u53ef\u7ed9default\u503c<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- c. binary, varbinary ----------<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7c7b\u4f3c\u4e8echar\u548cvarchar\uff0c\u7528\u4e8e\u4fdd\u5b58\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u4e5f\u5c31\u662f\u4fdd\u5b58\u5b57\u8282\u5b57\u7b26\u4e32\u800c\u975e\u5b57\u7b26\u5b57\u7b26\u4e32\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;char, varchar, text \u5bf9\u5e94 binary, varbinary, blob.<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>3. \u65e5\u671f\u65f6\u95f4\u7c7b\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4e00\u822c\u7528\u6574\u578b\u4fdd\u5b58\u65f6\u95f4\u6233\uff0c\u56e0\u4e3aPHP\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5c06\u65f6\u95f4\u6233\u8fdb\u884c\u683c\u5f0f\u5316\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;datetime &nbsp; &nbsp;8\u5b57\u8282 &nbsp; &nbsp;\u65e5\u671f\u53ca\u65f6\u95f4 &nbsp; &nbsp; 1000-01-01 00:00:00 \u5230 9999-12-31 23:59:59<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;date &nbsp; &nbsp; &nbsp; &nbsp;3\u5b57\u8282 &nbsp; &nbsp;\u65e5\u671f &nbsp; &nbsp; &nbsp; &nbsp; 1000-01-01 \u5230 9999-12-31<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;timestamp &nbsp; 4\u5b57\u8282 &nbsp; &nbsp;\u65f6\u95f4\u6233 &nbsp; &nbsp; &nbsp; &nbsp;19700101000000 \u5230 2038-01-19 03:14:07<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;time &nbsp; &nbsp; &nbsp; &nbsp;3\u5b57\u8282 &nbsp; &nbsp;\u65f6\u95f4 &nbsp; &nbsp; &nbsp; &nbsp; -838:59:59 \u5230 838:59:59<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;year &nbsp; &nbsp; &nbsp; &nbsp;1\u5b57\u8282 &nbsp; &nbsp;\u5e74\u4efd &nbsp; &nbsp; &nbsp; &nbsp; 1901 - 2155<br style=\"outline: 0px;\"  \/>datetime &nbsp; &nbsp;YYYY-MM-DD hh:mm:ss<br style=\"outline: 0px;\"  \/>timestamp &nbsp; YY-MM-DD hh:mm:ss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYYYMMDDhhmmss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYMMDDhhmmss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYYYMMDDhhmmss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYMMDDhhmmss<br style=\"outline: 0px;\"  \/>date &nbsp; &nbsp; &nbsp; &nbsp;YYYY-MM-DD<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YY-MM-DD<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYYYMMDD<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYMMDD<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYYYMMDD<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYMMDD<br style=\"outline: 0px;\"  \/>time &nbsp; &nbsp; &nbsp; &nbsp;hh:mm:ss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hhmmss<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hhmmss<br style=\"outline: 0px;\"  \/>year &nbsp; &nbsp; &nbsp; &nbsp;YYYY<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YY<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YYYY<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YY<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>4. \u679a\u4e3e\u548c\u96c6\u5408<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u679a\u4e3e(enum) ----------<\/span><br style=\"outline: 0px;\"  \/>enum(val1, val2, val3...)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5728\u5df2\u77e5\u7684\u503c\u4e2d\u8fdb\u884c\u5355\u9009\u3002\u6700\u5927\u6570\u91cf\u4e3a65535.<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u679a\u4e3e\u503c\u5728\u4fdd\u5b58\u65f6\uff0c\u4ee52\u4e2a\u5b57\u8282\u7684\u6574\u578b(smallint)\u4fdd\u5b58\u3002\u6bcf\u4e2a\u679a\u4e3e\u503c\uff0c\u6309\u4fdd\u5b58\u7684\u4f4d\u7f6e\u987a\u5e8f\uff0c\u4ece1\u5f00\u59cb\u9010\u4e00\u9012\u589e\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8868\u73b0\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u5b58\u50a8\u5374\u662f\u6574\u578b\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;NULL\u503c\u7684\u7d22\u5f15\u662fNULL\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7a7a\u5b57\u7b26\u4e32\u9519\u8bef\u503c\u7684\u7d22\u5f15\u503c\u662f0\u3002<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u96c6\u5408\uff08set\uff09 ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span>(val1, val2, val3...)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tab ( gender <span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span>(<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u7537'<\/span>, <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u5973'<\/span>, <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u65e0'<\/span>) );<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> tab <span style=\"outline: 0px;color: rgb(249, 38, 114);\">values<\/span> (<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u7537, \u5973'<\/span>);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6700\u591a\u53ef\u4ee5\u670964\u4e2a\u4e0d\u540c\u7684\u6210\u5458\u3002\u4ee5bigint\u5b58\u50a8\uff0c\u51718\u4e2a\u5b57\u8282\u3002\u91c7\u53d6\u4f4d\u8fd0\u7b97\u7684\u5f62\u5f0f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5f53\u521b\u5efa\u8868\u65f6\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span>\u6210\u5458\u503c\u7684\u5c3e\u90e8\u7a7a\u683c\u5c06\u81ea\u52a8\u88ab\u5220\u9664\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u9009\u62e9\u7c7b\u578b<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- PHP\u89d2\u5ea6<\/span><br style=\"outline: 0px;\"  \/>1. \u529f\u80fd\u6ee1\u8db3<br style=\"outline: 0px;\"  \/>2. \u5b58\u50a8\u7a7a\u95f4\u5c3d\u91cf\u5c0f\uff0c\u5904\u7406\u6548\u7387\u66f4\u9ad8<br style=\"outline: 0px;\"  \/>3. \u8003\u8651\u517c\u5bb9\u95ee\u9898<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- IP\u5b58\u50a8 ----------<\/span><br style=\"outline: 0px;\"  \/>1. \u53ea\u9700\u5b58\u50a8\uff0c\u53ef\u7528\u5b57\u7b26\u4e32<br style=\"outline: 0px;\"  \/>2. \u5982\u679c\u9700\u8ba1\u7b97\uff0c\u67e5\u627e\u7b49\uff0c\u53ef\u5b58\u50a8\u4e3a4\u4e2a\u5b57\u8282\u7684\u65e0\u7b26\u53f7int\uff0c\u5373unsigned<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;1) PHP\u51fd\u6570\u8f6c\u6362<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;ip2long\u53ef\u8f6c\u6362\u4e3a\u6574\u578b\uff0c\u4f46\u4f1a\u51fa\u73b0\u643a\u5e26\u7b26\u53f7\u95ee\u9898\u3002\u9700\u683c\u5f0f\u5316\u4e3a\u65e0\u7b26\u53f7\u7684\u6574\u578b\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5229\u7528sprintf\u51fd\u6570\u683c\u5f0f\u5316\u5b57\u7b26\u4e32<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;sprintf(\"%u\", ip2long('192.168.3.134'));<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u7136\u540e\u7528long2ip\u5c06\u6574\u578b\u8f6c\u56deIP\u5b57\u7b26\u4e32<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;2) MySQL\u51fd\u6570\u8f6c\u6362(\u65e0\u7b26\u53f7\u6574\u578b\uff0cUNSIGNED)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;INET_ATON('127.0.0.1') \u5c06IP\u8f6c\u4e3a\u6574\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;INET_NTOA(2130706433) \u5c06\u6574\u578b\u8f6c\u4e3aIP<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5217\u5c5e\u6027\uff08\u5217\u7ea6\u675f\uff09<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">1. PRIMARY \u4e3b\u952e<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u80fd\u552f\u4e00\u6807\u8bc6\u8bb0\u5f55\u7684\u5b57\u6bb5\uff0c\u53ef\u4ee5\u4f5c\u4e3a\u4e3b\u952e\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e00\u4e2a\u8868\u53ea\u80fd\u6709\u4e00\u4e2a\u4e3b\u952e\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e3b\u952e\u5177\u6709\u552f\u4e00\u6027\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u58f0\u660e\u5b57\u6bb5\u65f6\uff0c\u7528 primary key \u6807\u8bc6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e5f\u53ef\u4ee5\u5728\u5b57\u6bb5\u5217\u8868\u4e4b\u540e\u58f0\u660e<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u4f8b\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tab ( id <span style=\"outline: 0px;color: rgb(230, 219, 116);\">int<\/span>, stu <span style=\"outline: 0px;color: rgb(230, 219, 116);\">varchar<\/span>(<span style=\"outline: 0px;color: rgb(174, 129, 255);\">10<\/span>), <span style=\"outline: 0px;color: rgb(249, 38, 114);\">primary<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">key<\/span> (id));<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e3b\u952e\u5b57\u6bb5\u7684\u503c\u4e0d\u80fd\u4e3anull\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e3b\u952e\u53ef\u4ee5\u7531\u591a\u4e2a\u5b57\u6bb5\u5171\u540c\u7ec4\u6210\u3002\u6b64\u65f6\u9700\u8981\u5728\u5b57\u6bb5\u5217\u8868\u540e\u58f0\u660e\u7684\u65b9\u6cd5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4f8b\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tab ( id <span style=\"outline: 0px;color: rgb(230, 219, 116);\">int<\/span>, stu <span style=\"outline: 0px;color: rgb(230, 219, 116);\">varchar<\/span>(<span style=\"outline: 0px;color: rgb(174, 129, 255);\">10<\/span>), age <span style=\"outline: 0px;color: rgb(230, 219, 116);\">int<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">primary<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">key<\/span> (stu, age));<br style=\"outline: 0px;\"  \/>2. UNIQUE \u552f\u4e00\u7d22\u5f15\uff08\u552f\u4e00\u7ea6\u675f\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4f7f\u5f97\u67d0\u5b57\u6bb5\u7684\u503c\u4e5f\u4e0d\u80fd\u91cd\u590d\u3002<br style=\"outline: 0px;\"  \/>3. NULL \u7ea6\u675f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;null\u4e0d\u662f\u6570\u636e\u7c7b\u578b\uff0c\u662f\u5217\u7684\u4e00\u4e2a\u5c5e\u6027\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8868\u793a\u5f53\u524d\u5217\u662f\u5426\u53ef\u4ee5\u4e3anull\uff0c\u8868\u793a\u4ec0\u4e48\u90fd\u6ca1\u6709\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;null, \u5141\u8bb8\u4e3a\u7a7a\u3002\u9ed8\u8ba4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;not null, \u4e0d\u5141\u8bb8\u4e3a\u7a7a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> tab <span style=\"outline: 0px;color: rgb(249, 38, 114);\">values<\/span> (<span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>, <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'val'<\/span>);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6b64\u65f6\u8868\u793a\u5c06\u7b2c\u4e00\u4e2a\u5b57\u6bb5\u7684\u503c\u8bbe\u4e3anull, \u53d6\u51b3\u4e8e\u8be5\u5b57\u6bb5\u662f\u5426\u5141\u8bb8\u4e3anull<\/span><br style=\"outline: 0px;\"  \/>4. DEFAULT \u9ed8\u8ba4\u503c\u5c5e\u6027<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5f53\u524d\u5b57\u6bb5\u7684\u9ed8\u8ba4\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> tab <span style=\"outline: 0px;color: rgb(249, 38, 114);\">values<\/span> (<span style=\"outline: 0px;color: rgb(249, 38, 114);\">default<\/span>, <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'val'<\/span>); &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6b64\u65f6\u8868\u793a\u5f3a\u5236\u4f7f\u7528\u9ed8\u8ba4\u503c\u3002<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tab ( add_time <span style=\"outline: 0px;color: rgb(249, 38, 114);\">timestamp<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">default<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">current_timestamp<\/span> );<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8868\u793a\u5c06\u5f53\u524d\u65f6\u95f4\u7684\u65f6\u95f4\u6233\u8bbe\u4e3a\u9ed8\u8ba4\u503c\u3002<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;current_date, current_time<br style=\"outline: 0px;\"  \/>5. AUTO_INCREMENT \u81ea\u52a8\u589e\u957f\u7ea6\u675f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u81ea\u52a8\u589e\u957f\u5fc5\u987b\u4e3a\u7d22\u5f15\uff08\u4e3b\u952e\u6216unique\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u53ea\u80fd\u5b58\u5728\u4e00\u4e2a\u5b57\u6bb5\u4e3a\u81ea\u52a8\u589e\u957f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u9ed8\u8ba4\u4e3a1\u5f00\u59cb\u81ea\u52a8\u589e\u957f\u3002\u53ef\u4ee5\u901a\u8fc7\u8868\u5c5e\u6027 auto_increment = x\u8fdb\u884c\u8bbe\u7f6e\uff0c\u6216 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">alter<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tbl auto_increment = x;<br style=\"outline: 0px;\"  \/>6. COMMENT \u6ce8\u91ca<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4f8b\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">create<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> tab ( id <span style=\"outline: 0px;color: rgb(230, 219, 116);\">int<\/span> ) comment <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u6ce8\u91ca\u5185\u5bb9'<\/span>;<br style=\"outline: 0px;\"  \/>7. FOREIGN KEY \u5916\u952e\u7ea6\u675f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7528\u4e8e\u9650\u5236\u4e3b\u8868\u4e0e\u4ece\u8868\u6570\u636e\u5b8c\u6574\u6027\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">alter<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> t1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">add<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">constraint<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">`t1_t2_fk`<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">foreign<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">key<\/span> (t1_id) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">references<\/span> t2(id);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5c06\u8868t1\u7684t1_id\u5916\u952e\u5173\u8054\u5230\u8868t2\u7684id\u5b57\u6bb5\u3002<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6bcf\u4e2a\u5916\u952e\u90fd\u6709\u4e00\u4e2a\u540d\u5b57\uff0c\u53ef\u4ee5\u901a\u8fc7 constraint \u6307\u5b9a<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5b58\u5728\u5916\u952e\u7684\u8868\uff0c\u79f0\u4e4b\u4e3a\u4ece\u8868\uff08\u5b50\u8868\uff09\uff0c\u5916\u952e\u6307\u5411\u7684\u8868\uff0c\u79f0\u4e4b\u4e3a\u4e3b\u8868\uff08\u7236\u8868\uff09\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4f5c\u7528\uff1a\u4fdd\u6301\u6570\u636e\u4e00\u81f4\u6027\uff0c\u5b8c\u6574\u6027\uff0c\u4e3b\u8981\u76ee\u7684\u662f\u63a7\u5236\u5b58\u50a8\u5728\u5916\u952e\u8868\uff08\u4ece\u8868\uff09\u4e2d\u7684\u6570\u636e\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;MySQL\u4e2d\uff0c\u53ef\u4ee5\u5bf9InnoDB\u5f15\u64ce\u4f7f\u7528\u5916\u952e\u7ea6\u675f\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8bed\u6cd5\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;foreign key (\u5916\u952e\u5b57\u6bb5\uff09 references \u4e3b\u8868\u540d (\u5173\u8054\u5b57\u6bb5) [\u4e3b\u8868\u8bb0\u5f55\u5220\u9664\u65f6\u7684\u52a8\u4f5c] [\u4e3b\u8868\u8bb0\u5f55\u66f4\u65b0\u65f6\u7684\u52a8\u4f5c]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6b64\u65f6\u9700\u8981\u68c0\u6d4b\u4e00\u4e2a\u4ece\u8868\u7684\u5916\u952e\u9700\u8981\u7ea6\u675f\u4e3a\u4e3b\u8868\u7684\u5df2\u5b58\u5728\u7684\u503c\u3002\u5916\u952e\u5728\u6ca1\u6709\u5173\u8054\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u4e3anull.\u524d\u63d0\u662f\u8be5\u5916\u952e\u5217\uff0c\u6ca1\u6709not null\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u53ef\u4ee5\u4e0d\u6307\u5b9a\u4e3b\u8868\u8bb0\u5f55\u66f4\u6539\u6216\u66f4\u65b0\u65f6\u7684\u52a8\u4f5c\uff0c\u90a3\u4e48\u6b64\u65f6\u4e3b\u8868\u7684\u64cd\u4f5c\u88ab\u62d2\u7edd\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5982\u679c\u6307\u5b9a\u4e86 on <span style=\"outline: 0px;color: rgb(249, 38, 114);\">update<\/span> \u6216 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">on<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span>\uff1a\u5728\u5220\u9664\u6216\u66f4\u65b0\u65f6\uff0c\u6709\u5982\u4e0b\u51e0\u4e2a\u64cd\u4f5c\u53ef\u4ee5\u9009\u62e9\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1.<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">cascade<\/span>\uff0c\u7ea7\u8054\u64cd\u4f5c\u3002\u4e3b\u8868\u6570\u636e\u88ab\u66f4\u65b0\uff08\u4e3b\u952e\u503c\u66f4\u65b0\uff09\uff0c\u4ece\u8868\u4e5f\u88ab\u66f4\u65b0\uff08\u5916\u952e\u503c\u66f4\u65b0\uff09\u3002\u4e3b\u8868\u8bb0\u5f55\u88ab\u5220\u9664\uff0c\u4ece\u8868\u76f8\u5173\u8bb0\u5f55\u4e5f\u88ab\u5220\u9664\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">2.<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span> <span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\uff0c\u8bbe\u7f6e\u4e3a<span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\u3002\u4e3b\u8868\u6570\u636e\u88ab\u66f4\u65b0\uff08\u4e3b\u952e\u503c\u66f4\u65b0\uff09\uff0c\u4ece\u8868\u7684\u5916\u952e\u88ab\u8bbe\u7f6e\u4e3a<span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\u3002\u4e3b\u8868\u8bb0\u5f55\u88ab\u5220\u9664\uff0c\u4ece\u8868\u76f8\u5173\u8bb0\u5f55\u5916\u952e\u88ab\u8bbe\u7f6e\u6210<span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\u3002\u4f46\u6ce8\u610f\uff0c\u8981\u6c42\u8be5\u5916\u952e\u5217\uff0c\u6ca1\u6709<span style=\"outline: 0px;color: rgb(249, 38, 114);\">not<\/span> <span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\u5c5e\u6027\u7ea6\u675f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">3.<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">restrict<\/span>\uff0c\u62d2\u7edd\u7236\u8868\u5220\u9664\u548c\u66f4\u65b0\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6ce8\u610f\uff0c\u5916\u952e\u53ea\u88ab<span style=\"outline: 0px;color: rgb(249, 38, 114);\">InnoDB<\/span>\u5b58\u50a8\u5f15\u64ce\u6240\u652f\u6301\u3002\u5176\u4ed6\u5f15\u64ce\u662f\u4e0d\u652f\u6301\u7684\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5efa\u8868\u89c4\u8303<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- Normal Format, NF<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- \u6bcf\u4e2a\u8868\u4fdd\u5b58\u4e00\u4e2a\u5b9e\u4f53\u4fe1\u606f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- \u6bcf\u4e2a\u5177\u6709\u4e00\u4e2aID\u5b57\u6bb5\u4f5c\u4e3a\u4e3b\u952e<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- ID\u4e3b\u952e + \u539f\u5b50\u8868<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- 1NF, \u7b2c\u4e00\u8303\u5f0f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5b57\u6bb5\u4e0d\u80fd\u518d\u5206\uff0c\u5c31\u6ee1\u8db3\u7b2c\u4e00\u8303\u5f0f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- 2NF, \u7b2c\u4e8c\u8303\u5f0f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6ee1\u8db3\u7b2c\u4e00\u8303\u5f0f\u7684\u524d\u63d0\u4e0b\uff0c\u4e0d\u80fd\u51fa\u73b0\u90e8\u5206\u4f9d\u8d56\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6d88\u9664\u7b26\u5408\u4e3b\u952e\u5c31\u53ef\u4ee5\u907f\u514d\u90e8\u5206\u4f9d\u8d56\u3002\u589e\u52a0\u5355\u5217\u5173\u952e\u5b57\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- 3NF, \u7b2c\u4e09\u8303\u5f0f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u6ee1\u8db3\u7b2c\u4e8c\u8303\u5f0f\u7684\u524d\u63d0\u4e0b\uff0c\u4e0d\u80fd\u51fa\u73b0\u4f20\u9012\u4f9d\u8d56\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u67d0\u4e2a\u5b57\u6bb5\u4f9d\u8d56\u4e8e\u4e3b\u952e\uff0c\u800c\u6709\u5176\u4ed6\u5b57\u6bb5\u4f9d\u8d56\u4e8e\u8be5\u5b57\u6bb5\u3002\u8fd9\u5c31\u662f\u4f20\u9012\u4f9d\u8d56\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5c06\u4e00\u4e2a\u5b9e\u4f53\u4fe1\u606f\u7684\u6570\u636e\u653e\u5728\u4e00\u4e2a\u8868\u5185\u5b9e\u73b0\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">SELECT<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">SELECT [ALL|DISTINCT] select_expr FROM -&gt; WHERE -&gt; GROUP BY [\u5408\u8ba1\u51fd\u6570] -&gt; HAVING -&gt; ORDER BY -&gt; LIMIT<br style=\"outline: 0px;\"  \/>a. select_expr<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u53ef\u4ee5\u7528 * \u8868\u793a\u6240\u6709\u5b57\u6bb5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;select * from tb;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u53ef\u4ee5\u4f7f\u7528\u8868\u8fbe\u5f0f\uff08\u8ba1\u7b97\u516c\u5f0f\u3001\u51fd\u6570\u8c03\u7528\u3001\u5b57\u6bb5\u4e5f\u662f\u4e2a\u8868\u8fbe\u5f0f\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;select stu, 29+25, now() from tb;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u5217\u4f7f\u7528\u522b\u540d\u3002\u9002\u7528\u4e8e\u7b80\u5316\u5217\u6807\u8bc6\uff0c\u907f\u514d\u591a\u4e2a\u5217\u6807\u8bc6\u7b26\u91cd\u590d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- \u4f7f\u7528 as \u5173\u952e\u5b57\uff0c\u4e5f\u53ef\u7701\u7565 as.<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;select stu+10 as add10 from tb;<br style=\"outline: 0px;\"  \/>b. FROM \u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7528\u4e8e\u6807\u8bc6\u67e5\u8be2\u6765\u6e90\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u53ef\u4ee5\u4e3a\u8868\u8d77\u522b\u540d\u3002\u4f7f\u7528as\u5173\u952e\u5b57\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;SELECT * FROM tb1 AS tt, tb2 AS bb;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- from\u5b50\u53e5\u540e\uff0c\u53ef\u4ee5\u540c\u65f6\u51fa\u73b0\u591a\u4e2a\u8868\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;-- \u591a\u4e2a\u8868\u4f1a\u6a2a\u5411\u53e0\u52a0\u5230\u4e00\u8d77\uff0c\u800c\u6570\u636e\u4f1a\u5f62\u6210\u4e00\u4e2a\u7b1b\u5361\u5c14\u79ef\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;SELECT * FROM tb1, tb2;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u5411\u4f18\u5316\u7b26\u63d0\u793a\u5982\u4f55\u9009\u62e9\u7d22\u5f15<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;USE INDEX\u3001IGNORE INDEX\u3001FORCE INDEX<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;SELECT * FROM table1 USE INDEX (key1,key2) WHERE key1=1 AND key2=2 AND key3=3;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;SELECT * FROM table1 IGNORE INDEX (key3) WHERE key1=1 AND key2=2 AND key3=3;<br style=\"outline: 0px;\"  \/>c. WHERE \u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u4ecefrom\u83b7\u5f97\u7684\u6570\u636e\u6e90\u4e2d\u8fdb\u884c\u7b5b\u9009\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u6574\u578b1\u8868\u793a\u771f\uff0c0\u8868\u793a\u5047\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-- \u8868\u8fbe\u5f0f\u7531\u8fd0\u7b97\u7b26\u548c\u8fd0\u7b97\u6570\u7ec4\u6210\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;-- \u8fd0\u7b97\u6570\uff1a\u53d8\u91cf\uff08\u5b57\u6bb5\uff09\u3001\u503c\u3001\u51fd\u6570\u8fd4\u56de\u503c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;-- \u8fd0\u7b97\u7b26\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=, &lt;=&gt;, &lt;&gt;, !=, &lt;=, &lt;, &gt;=, &gt;, !, &amp;&amp;, ||,<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in (not) null, (not) like, (not) in, (not) between and, is (not), and, or, not, xor<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is\/is not \u52a0\u4e0ature\/false\/unknown\uff0c\u68c0\u9a8c\u67d0\u4e2a\u503c\u7684\u771f\u5047<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;=&gt;\u4e0e&lt;&gt;\u529f\u80fd\u76f8\u540c\uff0c&lt;=&gt;\u53ef\u7528\u4e8enull\u6bd4\u8f83<br style=\"outline: 0px;\"  \/>d. GROUP BY \u5b50\u53e5, \u5206\u7ec4\u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;GROUP BY \u5b57\u6bb5\/\u522b\u540d [\u6392\u5e8f\u65b9\u5f0f]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5206\u7ec4\u540e\u4f1a\u8fdb\u884c\u6392\u5e8f\u3002\u5347\u5e8f\uff1aASC\uff0c\u964d\u5e8f\uff1aDESC<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4ee5\u4e0b[\u5408\u8ba1\u51fd\u6570]\u9700\u914d\u5408 GROUP BY \u4f7f\u7528\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;count \u8fd4\u56de\u4e0d\u540c\u7684\u975eNULL\u503c\u6570\u76ee &nbsp;count(*)\u3001count(\u5b57\u6bb5)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;sum \u6c42\u548c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;max \u6c42\u6700\u5927\u503c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;min \u6c42\u6700\u5c0f\u503c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;avg \u6c42\u5e73\u5747\u503c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;group_concat \u8fd4\u56de\u5e26\u6709\u6765\u81ea\u4e00\u4e2a\u7ec4\u7684\u8fde\u63a5\u7684\u975eNULL\u503c\u7684\u5b57\u7b26\u4e32\u7ed3\u679c\u3002\u7ec4\u5185\u5b57\u7b26\u4e32\u8fde\u63a5\u3002<br style=\"outline: 0px;\"  \/>e. HAVING \u5b50\u53e5\uff0c\u6761\u4ef6\u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4e0e where \u529f\u80fd\u3001\u7528\u6cd5\u76f8\u540c\uff0c\u6267\u884c\u65f6\u673a\u4e0d\u540c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;where \u5728\u5f00\u59cb\u65f6\u6267\u884c\u68c0\u6d4b\u6570\u636e\uff0c\u5bf9\u539f\u6570\u636e\u8fdb\u884c\u8fc7\u6ee4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;having \u5bf9\u7b5b\u9009\u51fa\u7684\u7ed3\u679c\u518d\u6b21\u8fdb\u884c\u8fc7\u6ee4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;having \u5b57\u6bb5\u5fc5\u987b\u662f\u67e5\u8be2\u51fa\u6765\u7684\uff0cwhere \u5b57\u6bb5\u5fc5\u987b\u662f\u6570\u636e\u8868\u5b58\u5728\u7684\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;where \u4e0d\u53ef\u4ee5\u4f7f\u7528\u5b57\u6bb5\u7684\u522b\u540d\uff0chaving \u53ef\u4ee5\u3002\u56e0\u4e3a\u6267\u884cWHERE\u4ee3\u7801\u65f6\uff0c\u53ef\u80fd\u5c1a\u672a\u786e\u5b9a\u5217\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;where \u4e0d\u53ef\u4ee5\u4f7f\u7528\u5408\u8ba1\u51fd\u6570\u3002\u4e00\u822c\u9700\u7528\u5408\u8ba1\u51fd\u6570\u624d\u4f1a\u7528 having<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;SQL\u6807\u51c6\u8981\u6c42HAVING\u5fc5\u987b\u5f15\u7528GROUP BY\u5b50\u53e5\u4e2d\u7684\u5217\u6216\u7528\u4e8e\u5408\u8ba1\u51fd\u6570\u4e2d\u7684\u5217\u3002<br style=\"outline: 0px;\"  \/>f. ORDER BY \u5b50\u53e5\uff0c\u6392\u5e8f\u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;order by \u6392\u5e8f\u5b57\u6bb5\/\u522b\u540d \u6392\u5e8f\u65b9\u5f0f [,\u6392\u5e8f\u5b57\u6bb5\/\u522b\u540d \u6392\u5e8f\u65b9\u5f0f]...<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5347\u5e8f\uff1aASC\uff0c\u964d\u5e8f\uff1aDESC<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u652f\u6301\u591a\u4e2a\u5b57\u6bb5\u7684\u6392\u5e8f\u3002<br style=\"outline: 0px;\"  \/>g. LIMIT \u5b50\u53e5\uff0c\u9650\u5236\u7ed3\u679c\u6570\u91cf\u5b50\u53e5<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4ec5\u5bf9\u5904\u7406\u597d\u7684\u7ed3\u679c\u8fdb\u884c\u6570\u91cf\u9650\u5236\u3002\u5c06\u5904\u7406\u597d\u7684\u7ed3\u679c\u7684\u770b\u4f5c\u662f\u4e00\u4e2a\u96c6\u5408\uff0c\u6309\u7167\u8bb0\u5f55\u51fa\u73b0\u7684\u987a\u5e8f\uff0c\u7d22\u5f15\u4ece0\u5f00\u59cb\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;limit \u8d77\u59cb\u4f4d\u7f6e, \u83b7\u53d6\u6761\u6570<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u7701\u7565\u7b2c\u4e00\u4e2a\u53c2\u6570\uff0c\u8868\u793a\u4ece\u7d22\u5f150\u5f00\u59cb\u3002limit \u83b7\u53d6\u6761\u6570<br style=\"outline: 0px;\"  \/>h. DISTINCT, ALL \u9009\u9879<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;distinct \u53bb\u9664\u91cd\u590d\u8bb0\u5f55<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u9ed8\u8ba4\u4e3a all, \u5168\u90e8\u8bb0\u5f55<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">UNION<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"> &nbsp; &nbsp;\u5c06\u591a\u4e2a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u67e5\u8be2\u7684\u7ed3\u679c\u7ec4\u5408\u6210\u4e00\u4e2a\u7ed3\u679c\u96c6\u5408\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> ... <span style=\"outline: 0px;color: rgb(249, 38, 114);\">UNION<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span>|<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DISTINCT<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> ...<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u9ed8\u8ba4 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DISTINCT<\/span> \u65b9\u5f0f\uff0c\u5373\u6240\u6709\u8fd4\u56de\u7684\u884c\u90fd\u662f\u552f\u4e00\u7684<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5efa\u8bae\uff0c\u5bf9\u6bcf\u4e2a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span>\u67e5\u8be2\u52a0\u4e0a\u5c0f\u62ec\u53f7\u5305\u88f9\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ORDER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> \u6392\u5e8f\u65f6\uff0c\u9700\u52a0\u4e0a <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIMIT<\/span> \u8fdb\u884c\u7ed3\u5408\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u9700\u8981\u5404<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u67e5\u8be2\u7684\u5b57\u6bb5\u6570\u91cf\u4e00\u6837\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6bcf\u4e2a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u67e5\u8be2\u7684\u5b57\u6bb5\u5217\u8868(\u6570\u91cf\u3001\u7c7b\u578b)\u5e94\u4e00\u81f4\uff0c\u56e0\u4e3a\u7ed3\u679c\u4e2d\u7684\u5b57\u6bb5\u540d\u4ee5\u7b2c\u4e00\u6761<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u8bed\u53e5\u4e3a\u51c6\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5b50\u67e5\u8be2<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"> &nbsp; &nbsp;- \u5b50\u67e5\u8be2\u9700\u7528\u62ec\u53f7\u5305\u88f9\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- from\u578b<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;from\u540e\u8981\u6c42\u662f\u4e00\u4e2a\u8868\uff0c\u5fc5\u987b\u7ed9\u5b50\u67e5\u8be2\u7ed3\u679c\u53d6\u4e2a\u522b\u540d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u7b80\u5316\u6bcf\u4e2a\u67e5\u8be2\u5185\u7684\u6761\u4ef6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- from\u578b\u9700\u5c06\u7ed3\u679c\u751f\u6210\u4e00\u4e2a\u4e34\u65f6\u8868\u683c\uff0c\u53ef\u7528\u4ee5\u539f\u8868\u7684\u9501\u5b9a\u7684\u91ca\u653e\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5b50\u67e5\u8be2\u8fd4\u56de\u4e00\u4e2a\u8868\uff0c\u8868\u578b\u5b50\u67e5\u8be2\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> (<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tb <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> id&gt;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">0<\/span>) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">as<\/span> subfrom <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> id&gt;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- where\u578b<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5b50\u67e5\u8be2\u8fd4\u56de\u4e00\u4e2a\u503c\uff0c\u6807\u91cf\u5b50\u67e5\u8be2\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e0d\u9700\u8981\u7ed9\u5b50\u67e5\u8be2\u53d6\u522b\u540d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- where\u5b50\u67e5\u8be2\u5185\u7684\u8868\uff0c\u4e0d\u80fd\u76f4\u63a5\u7528\u4ee5\u66f4\u65b0\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tb <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> money = (<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">max<\/span>(money) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tb);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5217\u5b50\u67e5\u8be2<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5982\u679c\u5b50\u67e5\u8be2\u7ed3\u679c\u8fd4\u56de\u7684\u662f\u4e00\u5217\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4f7f\u7528 in \u6216 not in \u5b8c\u6210\u67e5\u8be2<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;exists \u548c not exists \u6761\u4ef6<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u5982\u679c\u5b50\u67e5\u8be2\u8fd4\u56de\u6570\u636e\uff0c\u5219\u8fd4\u56de1\u62160\u3002\u5e38\u7528\u4e8e\u5224\u65ad\u6761\u4ef6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> column1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> t1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">exists<\/span> (<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> t2);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u884c\u5b50\u67e5\u8be2<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u67e5\u8be2\u6761\u4ef6\u662f\u4e00\u4e2a\u884c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> t1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> (id, gender) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">in<\/span> (<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> id, gender <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> t2);<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u884c\u6784\u9020\u7b26\uff1a(col1, col2, ...) \u6216 ROW(col1, col2, ...)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u884c\u6784\u9020\u7b26\u901a\u5e38\u7528\u4e8e\u4e0e\u5bf9\u80fd\u8fd4\u56de\u4e24\u4e2a\u6216\u4e24\u4e2a\u4ee5\u4e0a\u5217\u7684\u5b50\u67e5\u8be2\u8fdb\u884c\u6bd4\u8f83\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7279\u6b8a\u8fd0\u7b97\u7b26<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;!= all() &nbsp; &nbsp;\u76f8\u5f53\u4e8e not in<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;= some() &nbsp; &nbsp;\u76f8\u5f53\u4e8e in\u3002any \u662f some \u7684\u522b\u540d<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;!= some() &nbsp; \u4e0d\u7b49\u540c\u4e8e not in\uff0c\u4e0d\u7b49\u4e8e\u5176\u4e2d\u67d0\u4e00\u4e2a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;all, some \u53ef\u4ee5\u914d\u5408\u5176\u4ed6\u8fd0\u7b97\u7b26\u4e00\u8d77\u4f7f\u7528\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u8fde\u63a5\u67e5\u8be2(join)<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"> &nbsp; &nbsp;\u5c06\u591a\u4e2a\u8868\u7684\u5b57\u6bb5\u8fdb\u884c\u8fde\u63a5\uff0c\u53ef\u4ee5\u6307\u5b9a\u8fde\u63a5\u6761\u4ef6\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5185\u8fde\u63a5(inner join)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u9ed8\u8ba4\u5c31\u662f\u5185\u8fde\u63a5\uff0c\u53ef\u7701\u7565inner\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53ea\u6709\u6570\u636e\u5b58\u5728\u65f6\u624d\u80fd\u53d1\u9001\u8fde\u63a5\u3002\u5373\u8fde\u63a5\u7ed3\u679c\u4e0d\u80fd\u51fa\u73b0\u7a7a\u884c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;on \u8868\u793a\u8fde\u63a5\u6761\u4ef6\u3002\u5176\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e0ewhere\u7c7b\u4f3c\u3002\u4e5f\u53ef\u4ee5\u7701\u7565\u6761\u4ef6\uff08\u8868\u793a\u6761\u4ef6\u6c38\u8fdc\u4e3a\u771f\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4e5f\u53ef\u7528where\u8868\u793a\u8fde\u63a5\u6761\u4ef6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8fd8\u6709 using, \u4f46\u9700\u5b57\u6bb5\u540d\u76f8\u540c\u3002 using(\u5b57\u6bb5\u540d)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4ea4\u53c9\u8fde\u63a5 cross join<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5373\uff0c\u6ca1\u6709\u6761\u4ef6\u7684\u5185\u8fde\u63a5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tb1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">cross<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">join<\/span> tb2;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5916\u8fde\u63a5(outer join)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5982\u679c\u6570\u636e\u4e0d\u5b58\u5728\uff0c\u4e5f\u4f1a\u51fa\u73b0\u5728\u8fde\u63a5\u7ed3\u679c\u4e2d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5de6\u5916\u8fde\u63a5 left join<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5982\u679c\u6570\u636e\u4e0d\u5b58\u5728\uff0c\u5de6\u8868\u8bb0\u5f55\u4f1a\u51fa\u73b0\uff0c\u800c\u53f3\u8868\u4e3anull\u586b\u5145<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53f3\u5916\u8fde\u63a5 right join<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5982\u679c\u6570\u636e\u4e0d\u5b58\u5728\uff0c\u53f3\u8868\u8bb0\u5f55\u4f1a\u51fa\u73b0\uff0c\u800c\u5de6\u8868\u4e3anull\u586b\u5145<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u81ea\u7136\u8fde\u63a5(natural join)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u81ea\u52a8\u5224\u65ad\u8fde\u63a5\u6761\u4ef6\u5b8c\u6210\u8fde\u63a5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u76f8\u5f53\u4e8e\u7701\u7565\u4e86using\uff0c\u4f1a\u81ea\u52a8\u67e5\u627e\u76f8\u540c\u5b57\u6bb5\u540d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;natural join<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;natural left join<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;natural right join<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> info.id, info.name, info.stu_num, extra_info.hobby, extra_info.sex <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> info, extra_info <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> info.stu_num = extra_info.stu_id;<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5bfc\u51fa<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">outfile<\/span> \u6587\u4ef6\u5730\u5740 [\u63a7\u5236\u683c\u5f0f] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> \u8868\u540d; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5bfc\u51fa\u8868\u6570\u636e<br style=\"outline: 0px;\"  \/><\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">load<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">data<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">local<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">infile<\/span> \u6587\u4ef6\u5730\u5740 [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">replace<\/span>|<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ignore<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">table<\/span> \u8868\u540d [\u63a7\u5236\u683c\u5f0f]; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5bfc\u5165\u6570\u636e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u751f\u6210\u7684\u6570\u636e\u9ed8\u8ba4\u7684\u5206\u9694\u7b26\u662f\u5236\u8868\u7b26<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;local\u672a\u6307\u5b9a\uff0c\u5219\u6570\u636e\u6587\u4ef6\u5fc5\u987b\u5728\u670d\u52a1\u5668\u4e0a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">replace<\/span> \u548c <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ignore<\/span> \u5173\u952e\u8bcd\u63a7\u5236\u5bf9\u73b0\u6709\u7684\u552f\u4e00\u952e\u8bb0\u5f55\u7684\u91cd\u590d\u7684\u5904\u7406<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u63a7\u5236\u683c\u5f0f<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">fields<\/span> &nbsp;\u63a7\u5236\u5b57\u6bb5\u683c\u5f0f<br style=\"outline: 0px;\"  \/>\u9ed8\u8ba4\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">fields<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">terminated<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'t'<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">enclosed<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">''<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">escaped<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\\'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">terminated<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'string'<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7ec8\u6b62<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">enclosed<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'char'<\/span> &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5305\u88f9<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">escaped<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'char'<\/span> &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8f6c\u4e49<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u793a\u4f8b\uff1a<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> a,b,a+b <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">OUTFILE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\/tmp\/result.text'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">FIELDS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TERMINATED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">','<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">OPTIONALLY<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ENCLOSED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\"'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LINES<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TERMINATED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'n'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> test_table;<br style=\"outline: 0px;\"  \/>lines &nbsp; \u63a7\u5236\u884c\u683c\u5f0f<br style=\"outline: 0px;\"  \/>\u9ed8\u8ba4\uff1alines terminated by 'n'<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;terminated by 'string' &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7ec8\u6b62<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">INSERT<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u8bed\u53e5\u83b7\u5f97\u7684\u6570\u636e\u53ef\u4ee5\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>\u63d2\u5165\u3002<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u7701\u7565\u5bf9\u5217\u7684\u6307\u5b9a\uff0c\u8981\u6c42 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">values<\/span> () \u62ec\u53f7\u5185\uff0c\u63d0\u4f9b\u7ed9\u4e86\u6309\u7167\u5217\u987a\u5e8f\u51fa\u73b0\u7684\u6240\u6709\u5b57\u6bb5\u7684\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6216\u8005\u4f7f\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span>\u8bed\u6cd5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">field<\/span>=<span style=\"outline: 0px;color: rgb(249, 38, 114);\">value<\/span>,...\uff1b<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u4e00\u6b21\u6027\u4f7f\u7528\u591a\u4e2a\u503c\uff0c\u91c7\u7528(), (), ();\u7684\u5f62\u5f0f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VALUES<\/span> (), (), ();<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u5728\u5217\u503c\u6307\u5b9a\u65f6\uff0c\u4f7f\u7528\u8868\u8fbe\u5f0f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VALUES<\/span> (field_value, <span style=\"outline: 0px;color: rgb(174, 129, 255);\">10<\/span>+<span style=\"outline: 0px;color: rgb(174, 129, 255);\">10<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">now<\/span>());<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u7279\u6b8a\u503c DEFAULT\uff0c\u8868\u793a\u8be5\u5217\u4f7f\u7528\u9ed8\u8ba4\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VALUES<\/span> (field_value, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DEFAULT<\/span>);<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2a\u67e5\u8be2\u7684\u7ed3\u679c\uff0c\u4f5c\u4e3a\u9700\u8981\u63d2\u5165\u7684\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> ...;<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u6307\u5b9a\u5728\u63d2\u5165\u7684\u503c\u51fa\u73b0\u4e3b\u952e\uff08\u6216\u552f\u4e00\u7d22\u5f15\uff09\u51b2\u7a81\u65f6\uff0c\u66f4\u65b0\u5176\u4ed6\u975e\u4e3b\u952e\u5217\u7684\u4fe1\u606f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">INTO<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VALUES<\/span>\/<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span>\/<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> DUPLICATE <span style=\"outline: 0px;color: rgb(249, 38, 114);\">KEY<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">UPDATE<\/span> \u5b57\u6bb5=\u503c, \u2026;<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">DELETE<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(249, 38, 114);\">DELETE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> tbl_name [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">WHERE<\/span> where_definition] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ORDER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> ...] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIMIT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">row_count<\/span>]<br style=\"outline: 0px;\"  \/>\u6309\u7167\u6761\u4ef6\u5220\u9664\u3002<span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span><br style=\"outline: 0px;\"  \/>\u6307\u5b9a\u5220\u9664\u7684\u6700\u591a\u8bb0\u5f55\u6570\u3002<span style=\"outline: 0px;color: rgb(249, 38, 114);\">limit<\/span><br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u901a\u8fc7\u6392\u5e8f\u6761\u4ef6\u5220\u9664\u3002<span style=\"outline: 0px;color: rgb(249, 38, 114);\">order<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">by<\/span> + <span style=\"outline: 0px;color: rgb(249, 38, 114);\">limit<\/span><br style=\"outline: 0px;\"  \/>\u652f\u6301\u591a\u8868\u5220\u9664\uff0c\u4f7f\u7528\u7c7b\u4f3c\u8fde\u63a5\u8bed\u6cd5\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> \u9700\u8981\u5220\u9664\u6570\u636e\u591a\u8868<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1<\/span>\uff0c\u8868<span style=\"outline: 0px;color: rgb(174, 129, 255);\">2<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">using<\/span> \u8868\u8fde\u63a5\u64cd\u4f5c \u6761\u4ef6\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">TRUNCATE<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRUNCATE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span>] tbl_name<br style=\"outline: 0px;\"  \/>\u6e05\u7a7a\u6570\u636e<br style=\"outline: 0px;\"  \/>\u5220\u9664\u91cd\u5efa\u8868<br style=\"outline: 0px;\"  \/>\u533a\u522b\uff1a<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">1<\/span>\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">truncate<\/span> \u662f\u5220\u9664\u8868\u518d\u521b\u5efa\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span> \u662f\u9010\u6761\u5220\u9664<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">2<\/span>\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">truncate<\/span> \u91cd\u7f6eauto_increment\u7684\u503c\u3002\u800c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span>\u4e0d\u4f1a<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">3<\/span>\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">truncate<\/span> \u4e0d\u77e5\u9053\u5220\u9664\u4e86\u51e0\u6761\uff0c\u800c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span>\u77e5\u9053\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">4<\/span>\uff0c\u5f53\u88ab\u7528\u4e8e\u5e26\u5206\u533a\u7684\u8868\u65f6\uff0c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">truncate<\/span> \u4f1a\u4fdd\u7559\u5206\u533a<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u5907\u4efd\u4e0e\u8fd8\u539f<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">\u5907\u4efd\uff0c\u5c06\u6570\u636e\u7684\u7ed3\u6784\u4e0e\u8868\u5185\u6570\u636e\u4fdd\u5b58\u8d77\u6765\u3002<br style=\"outline: 0px;\"  \/>\u5229\u7528 mysqldump \u6307\u4ee4\u5b8c\u6210\u3002<br style=\"outline: 0px;\"  \/>-- \u5bfc\u51fa<br style=\"outline: 0px;\"  \/>mysqldump [options] db_name [tables]<br style=\"outline: 0px;\"  \/>mysqldump [options] ---database DB1 [DB2 DB3...]<br style=\"outline: 0px;\"  \/>mysqldump [options] --all--database<br style=\"outline: 0px;\"  \/>1. \u5bfc\u51fa\u4e00\u5f20\u8868<br style=\"outline: 0px;\"  \/>\u3000\u3000mysqldump -u\u7528\u6237\u540d -p\u5bc6\u7801 \u5e93\u540d \u8868\u540d &gt; \u6587\u4ef6\u540d(D:\/a.sql)<br style=\"outline: 0px;\"  \/>2. \u5bfc\u51fa\u591a\u5f20\u8868<br style=\"outline: 0px;\"  \/>\u3000\u3000mysqldump -u\u7528\u6237\u540d -p\u5bc6\u7801 \u5e93\u540d \u88681 \u88682 \u88683 &gt; \u6587\u4ef6\u540d(D:\/a.sql)<br style=\"outline: 0px;\"  \/>3. \u5bfc\u51fa\u6240\u6709\u8868<br style=\"outline: 0px;\"  \/>\u3000\u3000mysqldump -u\u7528\u6237\u540d -p\u5bc6\u7801 \u5e93\u540d &gt; \u6587\u4ef6\u540d(D:\/a.sql)<br style=\"outline: 0px;\"  \/>4. \u5bfc\u51fa\u4e00\u4e2a\u5e93<br style=\"outline: 0px;\"  \/>\u3000\u3000mysqldump -u\u7528\u6237\u540d -p\u5bc6\u7801 --lock-all-tables --database \u5e93\u540d &gt; \u6587\u4ef6\u540d(D:\/a.sql)<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5-w\u643a\u5e26WHERE\u6761\u4ef6<br style=\"outline: 0px;\"  \/>-- \u5bfc\u5165<br style=\"outline: 0px;\"  \/>1. \u5728\u767b\u5f55mysql\u7684\u60c5\u51b5\u4e0b\uff1a<br style=\"outline: 0px;\"  \/>\u3000\u3000source &nbsp;\u5907\u4efd\u6587\u4ef6<br style=\"outline: 0px;\"  \/>2. \u5728\u4e0d\u767b\u5f55\u7684\u60c5\u51b5\u4e0b<br style=\"outline: 0px;\"  \/>\u3000\u3000mysql -u\u7528\u6237\u540d -p\u5bc6\u7801 \u5e93\u540d &lt; \u5907\u4efd\u6587\u4ef6<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u89c6\u56fe<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">\u4ec0\u4e48\u662f\u89c6\u56fe\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u89c6\u56fe\u662f\u4e00\u4e2a\u865a\u62df\u8868\uff0c\u5176\u5185\u5bb9\u7531\u67e5\u8be2\u5b9a\u4e49\u3002\u540c\u771f\u5b9e\u7684\u8868\u4e00\u6837\uff0c\u89c6\u56fe\u5305\u542b\u4e00\u7cfb\u5217\u5e26\u6709\u540d\u79f0\u7684\u5217\u548c\u884c\u6570\u636e\u3002\u4f46\u662f\uff0c\u89c6\u56fe\u5e76\u4e0d\u5728\u6570\u636e\u5e93\u4e2d\u4ee5\u5b58\u50a8\u7684\u6570\u636e\u503c\u96c6\u5f62\u5f0f\u5b58\u5728\u3002\u884c\u548c\u5217\u6570\u636e\u6765\u81ea\u7531\u5b9a\u4e49\u89c6\u56fe\u7684\u67e5\u8be2\u6240\u5f15\u7528\u7684\u8868\uff0c\u5e76\u4e14\u5728\u5f15\u7528\u89c6\u56fe\u65f6\u52a8\u6001\u751f\u6210\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u89c6\u56fe\u5177\u6709\u8868\u7ed3\u6784\u6587\u4ef6\uff0c\u4f46\u4e0d\u5b58\u5728\u6570\u636e\u6587\u4ef6\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5bf9\u5176\u4e2d\u6240\u5f15\u7528\u7684\u57fa\u7840\u8868\u6765\u8bf4\uff0c\u89c6\u56fe\u7684\u4f5c\u7528\u7c7b\u4f3c\u4e8e\u7b5b\u9009\u3002\u5b9a\u4e49\u89c6\u56fe\u7684\u7b5b\u9009\u53ef\u4ee5\u6765\u81ea\u5f53\u524d\u6216\u5176\u5b83\u6570\u636e\u5e93\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\uff0c\u6216\u8005\u5176\u5b83\u89c6\u56fe\u3002\u901a\u8fc7\u89c6\u56fe\u8fdb\u884c\u67e5\u8be2\u6ca1\u6709\u4efb\u4f55\u9650\u5236\uff0c\u901a\u8fc7\u5b83\u4eec\u8fdb\u884c\u6570\u636e\u4fee\u6539\u65f6\u7684\u9650\u5236\u4e5f\u5f88\u5c11\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u89c6\u56fe\u662f\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u67e5\u8be2\u7684sql\u8bed\u53e5\uff0c\u5b83\u4e3b\u8981\u51fa\u4e8e\u4e24\u79cd\u539f\u56e0\uff1a\u5b89\u5168\u539f\u56e0\uff0c\u89c6\u56fe\u53ef\u4ee5\u9690\u85cf\u4e00\u4e9b\u6570\u636e\uff0c\u5982\uff1a\u793e\u4f1a\u4fdd\u9669\u57fa\u91d1\u8868\uff0c\u53ef\u4ee5\u7528\u89c6\u56fe\u53ea\u663e\u793a\u59d3\u540d\uff0c\u5730\u5740\uff0c\u800c\u4e0d\u663e\u793a\u793e\u4f1a\u4fdd\u9669\u53f7\u548c\u5de5\u8d44\u6570\u7b49\uff0c\u53e6\u4e00\u539f\u56e0\u662f\u53ef\u4f7f\u590d\u6742\u7684\u67e5\u8be2\u6613\u4e8e\u7406\u89e3\u548c\u4f7f\u7528\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u89c6\u56fe<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">OR<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">REPLACE<\/span>] [ALGORITHM = {UNDEFINED | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">MERGE<\/span> | TEMPTABLE}] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> view_name [(column_list)] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">AS<\/span> select_statement<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u89c6\u56fe\u540d\u5fc5\u987b\u552f\u4e00\uff0c\u540c\u65f6\u4e0d\u80fd\u4e0e\u8868\u91cd\u540d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u89c6\u56fe\u53ef\u4ee5\u4f7f\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u8bed\u53e5\u67e5\u8be2\u5230\u7684\u5217\u540d\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5df1\u6307\u5b9a\u76f8\u5e94\u7684\u5217\u540d\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53ef\u4ee5\u6307\u5b9a\u89c6\u56fe\u6267\u884c\u7684\u7b97\u6cd5\uff0c\u901a\u8fc7ALGORITHM\u6307\u5b9a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- column_list\u5982\u679c\u5b58\u5728\uff0c\u5219\u6570\u76ee\u5fc5\u987b\u7b49\u4e8e<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span>\u8bed\u53e5\u68c0\u7d22\u7684\u5217\u6570<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u7ed3\u6784<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> view_name<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u89c6\u56fe<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5220\u9664\u89c6\u56fe\u540e\uff0c\u6570\u636e\u4f9d\u7136\u5b58\u5728\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53ef\u540c\u65f6\u5220\u9664\u591a\u4e2a\u89c6\u56fe\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] view_name ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u89c6\u56fe\u7ed3\u6784<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e00\u822c\u4e0d\u4fee\u6539\u89c6\u56fe\uff0c\u56e0\u4e3a\u4e0d\u662f\u6240\u6709\u7684\u66f4\u65b0\u89c6\u56fe\u90fd\u4f1a\u6620\u5c04\u5230\u8868\u4e0a\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> view_name [(column_list)] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">AS<\/span> select_statement<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u89c6\u56fe\u4f5c\u7528<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1.<\/span> \u7b80\u5316\u4e1a\u52a1\u903b\u8f91<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">2.<\/span> \u5bf9\u5ba2\u6237\u7aef\u9690\u85cf\u771f\u5b9e\u7684\u8868\u7ed3\u6784<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u89c6\u56fe\u7b97\u6cd5(ALGORITHM)<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">MERGE<\/span> &nbsp; &nbsp; &nbsp; \u5408\u5e76<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5c06\u89c6\u56fe\u7684\u67e5\u8be2\u8bed\u53e5\uff0c\u4e0e\u5916\u90e8\u67e5\u8be2\u9700\u8981\u5148\u5408\u5e76\u518d\u6267\u884c\uff01<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;TEMPTABLE &nbsp; \u4e34\u65f6\u8868<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u5c06\u89c6\u56fe\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u5f62\u6210\u4e34\u65f6\u8868\uff0c\u518d\u505a\u5916\u5c42\u67e5\u8be2\uff01<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;UNDEFINED &nbsp; \u672a\u5b9a\u4e49(\u9ed8\u8ba4)\uff0c\u6307\u7684\u662fMySQL\u81ea\u4e3b\u53bb\u9009\u62e9\u76f8\u5e94\u7684\u7b97\u6cd5\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u4e8b\u52a1(transaction)<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">\u4e8b\u52a1\u662f\u6307\u903b\u8f91\u4e0a\u7684\u4e00\u7ec4\u64cd\u4f5c\uff0c\u7ec4\u6210\u8fd9\u7ec4\u64cd\u4f5c\u7684\u5404\u4e2a\u5355\u5143\uff0c\u8981\u4e0d\u5168\u6210\u529f\u8981\u4e0d\u5168\u5931\u8d25\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u652f\u6301\u8fde\u7eedSQL\u7684\u96c6\u4f53\u6210\u529f\u6216\u96c6\u4f53\u64a4\u9500\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e8b\u52a1\u662f\u6570\u636e\u5e93\u5728\u6570\u636e\u665a\u81ea\u4e60\u65b9\u9762\u7684\u4e00\u4e2a\u529f\u80fd\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u9700\u8981\u5229\u7528 InnoDB \u6216 BDB \u5b58\u50a8\u5f15\u64ce\uff0c\u5bf9\u81ea\u52a8\u63d0\u4ea4\u7684\u7279\u6027\u652f\u6301\u5b8c\u6210\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- InnoDB\u88ab\u79f0\u4e3a\u4e8b\u52a1\u5b89\u5168\u578b\u5f15\u64ce\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u5f00\u542f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">START<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRANSACTION<\/span>; \u6216\u8005 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BEGIN<\/span>;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5f00\u542f\u4e8b\u52a1\u540e\uff0c\u6240\u6709\u88ab\u6267\u884c\u7684SQL\u8bed\u53e5\u5747\u88ab\u8ba4\u4f5c\u5f53\u524d\u4e8b\u52a1\u5185\u7684SQL\u8bed\u53e5\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u63d0\u4ea4<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">COMMIT<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u56de\u6eda<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ROLLBACK<\/span>;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5982\u679c\u90e8\u5206\u64cd\u4f5c\u53d1\u751f\u95ee\u9898\uff0c\u6620\u5c04\u5230\u4e8b\u52a1\u5f00\u542f\u524d\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u7684\u7279\u6027<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;1. \u539f\u5b50\u6027\uff08Atomicity\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e8b\u52a1\u662f\u4e00\u4e2a\u4e0d\u53ef\u5206\u5272\u7684\u5de5\u4f5c\u5355\u4f4d\uff0c\u4e8b\u52a1\u4e2d\u7684\u64cd\u4f5c\u8981\u4e48\u90fd\u53d1\u751f\uff0c\u8981\u4e48\u90fd\u4e0d\u53d1\u751f\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;2. \u4e00\u81f4\u6027\uff08Consistency\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e8b\u52a1\u524d\u540e\u6570\u636e\u7684\u5b8c\u6574\u6027\u5fc5\u987b\u4fdd\u6301\u4e00\u81f4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- \u4e8b\u52a1\u5f00\u59cb\u548c\u7ed3\u675f\u65f6\uff0c\u5916\u90e8\u6570\u636e\u4e00\u81f4<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;- \u5728\u6574\u4e2a\u4e8b\u52a1\u8fc7\u7a0b\u4e2d\uff0c\u64cd\u4f5c\u662f\u8fde\u7eed\u7684<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;3. \u9694\u79bb\u6027\uff08Isolation\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u591a\u4e2a\u7528\u6237\u5e76\u53d1\u8bbf\u95ee\u6570\u636e\u5e93\u65f6\uff0c\u4e00\u4e2a\u7528\u6237\u7684\u4e8b\u52a1\u4e0d\u80fd\u88ab\u5176\u5b83\u7528\u6237\u7684\u4e8b\u7269\u6240\u5e72\u6270\uff0c\u591a\u4e2a\u5e76\u53d1\u4e8b\u52a1\u4e4b\u95f4\u7684\u6570\u636e\u8981\u76f8\u4e92\u9694\u79bb\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;4. \u6301\u4e45\u6027\uff08Durability\uff09<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u4e00\u4e2a\u4e8b\u52a1\u4e00\u65e6\u88ab\u63d0\u4ea4\uff0c\u5b83\u5bf9\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u6539\u53d8\u5c31\u662f\u6c38\u4e45\u6027\u7684\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u7684\u5b9e\u73b0<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;1. \u8981\u6c42\u662f\u4e8b\u52a1\u652f\u6301\u7684\u8868\u7c7b\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;2. \u6267\u884c\u4e00\u7ec4\u76f8\u5173\u7684\u64cd\u4f5c\u524d\u5f00\u542f\u4e8b\u52a1<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;3. \u6574\u7ec4\u64cd\u4f5c\u5b8c\u6210\u540e\uff0c\u90fd\u6210\u529f\uff0c\u5219\u63d0\u4ea4\uff1b\u5982\u679c\u5b58\u5728\u5931\u8d25\uff0c\u9009\u62e9\u56de\u6eda\uff0c\u5219\u4f1a\u56de\u5230\u4e8b\u52a1\u5f00\u59cb\u7684\u5907\u4efd\u70b9\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e8b\u52a1\u7684\u539f\u7406<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5229\u7528InnoDB\u7684\u81ea\u52a8\u63d0\u4ea4(autocommit)\u7279\u6027\u5b8c\u6210\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u666e\u901a\u7684MySQL\u6267\u884c\u8bed\u53e5\u540e\uff0c\u5f53\u524d\u7684\u6570\u636e\u63d0\u4ea4\u64cd\u4f5c\u5747\u53ef\u88ab\u5176\u4ed6\u5ba2\u6237\u7aef\u53ef\u89c1\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u800c\u4e8b\u52a1\u662f\u6682\u65f6\u5173\u95ed\u201c\u81ea\u52a8\u63d0\u4ea4\u201d\u673a\u5236\uff0c\u9700\u8981<span style=\"outline: 0px;color: rgb(249, 38, 114);\">commit<\/span>\u63d0\u4ea4\u6301\u4e45\u5316\u6570\u636e\u64cd\u4f5c\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6ce8\u610f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1.<\/span> \u6570\u636e\u5b9a\u4e49\u8bed\u8a00\uff08DDL\uff09\u8bed\u53e5\u4e0d\u80fd\u88ab\u56de\u6eda\uff0c\u6bd4\u5982\u521b\u5efa\u6216\u53d6\u6d88\u6570\u636e\u5e93\u7684\u8bed\u53e5\uff0c\u548c\u521b\u5efa\u3001\u53d6\u6d88\u6216\u66f4\u6539\u8868\u6216\u5b58\u50a8\u7684\u5b50\u7a0b\u5e8f\u7684\u8bed\u53e5\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">2.<\/span> \u4e8b\u52a1\u4e0d\u80fd\u88ab\u5d4c\u5957<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fdd\u5b58\u70b9<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SAVEPOINT<\/span> \u4fdd\u5b58\u70b9\u540d\u79f0 <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8bbe\u7f6e\u4e00\u4e2a\u4e8b\u52a1\u4fdd\u5b58\u70b9<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ROLLBACK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SAVEPOINT<\/span> \u4fdd\u5b58\u70b9\u540d\u79f0 <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u56de\u6eda\u5230\u4fdd\u5b58\u70b9<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">RELEASE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SAVEPOINT<\/span> \u4fdd\u5b58\u70b9\u540d\u79f0 <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u4fdd\u5b58\u70b9<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- InnoDB\u81ea\u52a8\u63d0\u4ea4\u7279\u6027\u8bbe\u7f6e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> autocommit = <span style=\"outline: 0px;color: rgb(174, 129, 255);\">0<\/span>|<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1<\/span>; &nbsp; 0\u8868\u793a\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4\uff0c1\u8868\u793a\u5f00\u542f\u81ea\u52a8\u63d0\u4ea4\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5982\u679c\u5173\u95ed\u4e86\uff0c\u90a3\u666e\u901a\u64cd\u4f5c\u7684\u7ed3\u679c\u5bf9\u5176\u4ed6\u5ba2\u6237\u7aef\u4e5f\u4e0d\u53ef\u89c1\uff0c\u9700\u8981<span style=\"outline: 0px;color: rgb(249, 38, 114);\">commit<\/span>\u63d0\u4ea4\u540e\u624d\u80fd\u6301\u4e45\u5316\u6570\u636e\u64cd\u4f5c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e5f\u53ef\u4ee5\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4\u6765\u5f00\u542f\u4e8b\u52a1\u3002\u4f46\u4e0e<span style=\"outline: 0px;color: rgb(249, 38, 114);\">START<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRANSACTION<\/span>\u4e0d\u540c\u7684\u662f\uff0c<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> autocommit\u662f\u6c38\u4e45\u6539\u53d8\u670d\u52a1\u5668\u7684\u8bbe\u7f6e\uff0c\u76f4\u5230\u4e0b\u6b21\u518d\u6b21\u4fee\u6539\u8be5\u8bbe\u7f6e\u3002(\u9488\u5bf9\u5f53\u524d\u8fde\u63a5)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u800c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">START<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRANSACTION<\/span>\u8bb0\u5f55\u5f00\u542f\u524d\u7684\u72b6\u6001\uff0c\u800c\u4e00\u65e6\u4e8b\u52a1\u63d0\u4ea4\u6216\u56de\u6eda\u540e\u5c31\u9700\u8981\u518d\u6b21\u5f00\u542f\u4e8b\u52a1\u3002(\u9488\u5bf9\u5f53\u524d\u4e8b\u52a1)<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u9501\u8868<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">\u8868\u9501\u5b9a\u53ea\u7528\u4e8e\u9632\u6b62\u5176\u5b83\u5ba2\u6237\u7aef\u8fdb\u884c\u4e0d\u6b63\u5f53\u5730\u8bfb\u53d6\u548c\u5199\u5165<br style=\"outline: 0px;\"  \/>MyISAM \u652f\u6301\u8868\u9501\uff0cInnoDB \u652f\u6301\u884c\u9501<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u9501\u5b9a<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span> tbl_name [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">AS<\/span> alias]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u89e3\u9501<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">UNLOCK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u89e6\u53d1\u5668<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"> &nbsp; &nbsp;\u89e6\u53d1\u7a0b\u5e8f\u662f\u4e0e\u8868\u6709\u5173\u7684\u547d\u540d\u6570\u636e\u5e93\u5bf9\u8c61\uff0c\u5f53\u8be5\u8868\u51fa\u73b0\u7279\u5b9a\u4e8b\u4ef6\u65f6\uff0c\u5c06\u6fc0\u6d3b\u8be5\u5bf9\u8c61<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u76d1\u542c\uff1a\u8bb0\u5f55\u7684\u589e\u52a0\u3001\u4fee\u6539\u3001\u5220\u9664\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u89e6\u53d1\u5668<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRIGGER<\/span> trigger_name trigger_time trigger_event <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOR<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EACH<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ROW<\/span> trigger_stmt<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u53c2\u6570\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;trigger_time\u662f\u89e6\u53d1\u7a0b\u5e8f\u7684\u52a8\u4f5c\u65f6\u95f4\u3002\u5b83\u53ef\u4ee5\u662f <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> \u6216 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">after<\/span>\uff0c\u4ee5\u6307\u660e\u89e6\u53d1\u7a0b\u5e8f\u662f\u5728\u6fc0\u6d3b\u5b83\u7684\u8bed\u53e5\u4e4b\u524d\u6216\u4e4b\u540e\u89e6\u53d1\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;trigger_event\u6307\u660e\u4e86\u6fc0\u6d3b\u89e6\u53d1\u7a0b\u5e8f\u7684\u8bed\u53e5\u7684\u7c7b\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span>\uff1a\u5c06\u65b0\u884c\u63d2\u5165\u8868\u65f6\u6fc0\u6d3b\u89e6\u53d1\u7a0b\u5e8f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">UPDATE<\/span>\uff1a\u66f4\u6539\u67d0\u4e00\u884c\u65f6\u6fc0\u6d3b\u89e6\u53d1\u7a0b\u5e8f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DELETE<\/span>\uff1a\u4ece\u8868\u4e2d\u5220\u9664\u67d0\u4e00\u884c\u65f6\u6fc0\u6d3b\u89e6\u53d1\u7a0b\u5e8f<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;tbl_name\uff1a\u76d1\u542c\u7684\u8868\uff0c\u5fc5\u987b\u662f\u6c38\u4e45\u6027\u7684\u8868\uff0c\u4e0d\u80fd\u5c06\u89e6\u53d1\u7a0b\u5e8f\u4e0e<span style=\"outline: 0px;color: rgb(249, 38, 114);\">TEMPORARY<\/span>\u8868\u6216\u89c6\u56fe\u5173\u8054\u8d77\u6765\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;trigger_stmt\uff1a\u5f53\u89e6\u53d1\u7a0b\u5e8f\u6fc0\u6d3b\u65f6\u6267\u884c\u7684\u8bed\u53e5\u3002\u6267\u884c\u591a\u4e2a\u8bed\u53e5\uff0c\u53ef\u4f7f\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">BEGIN<\/span>...<span style=\"outline: 0px;color: rgb(249, 38, 114);\">END<\/span>\u590d\u5408\u8bed\u53e5\u7ed3\u6784<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TRIGGER<\/span> [schema_name.]trigger_name<br style=\"outline: 0px;\"  \/>\u53ef\u4ee5\u4f7f\u7528old\u548cnew\u4ee3\u66ff\u65e7\u7684\u548c\u65b0\u7684\u6570\u636e<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u66f4\u65b0\u64cd\u4f5c\uff0c\u66f4\u65b0\u524d\u662fold\uff0c\u66f4\u65b0\u540e\u662fnew.<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5220\u9664\u64cd\u4f5c\uff0c\u53ea\u6709old.<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u589e\u52a0\u64cd\u4f5c\uff0c\u53ea\u6709new.<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6ce8\u610f<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(174, 129, 255);\">1.<\/span> \u5bf9\u4e8e\u5177\u6709\u76f8\u540c\u89e6\u53d1\u7a0b\u5e8f\u52a8\u4f5c\u65f6\u95f4\u548c\u4e8b\u4ef6\u7684\u7ed9\u5b9a\u8868\uff0c\u4e0d\u80fd\u6709\u4e24\u4e2a\u89e6\u53d1\u7a0b\u5e8f\u3002<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\"><br style=\"outline: 0px;\"  \/><\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b57\u7b26\u8fde\u63a5\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/>concat(str1,str2,...])<br style=\"outline: 0px;\"  \/>concat_ws(separator,str1,str2,...)<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5206\u652f\u8bed\u53e5<\/span><br style=\"outline: 0px;\"  \/>if \u6761\u4ef6 then<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6267\u884c\u8bed\u53e5<br style=\"outline: 0px;\"  \/>elseif \u6761\u4ef6 then<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6267\u884c\u8bed\u53e5<br style=\"outline: 0px;\"  \/>else<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u6267\u884c\u8bed\u53e5<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">if<\/span>;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u6700\u5916\u5c42\u8bed\u53e5\u7ed3\u675f\u7b26<\/span><br style=\"outline: 0px;\"  \/>delimiter \u81ea\u5b9a\u4e49\u7ed3\u675f\u7b26\u53f7<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;SQL\u8bed\u53e5<br style=\"outline: 0px;\"  \/>\u81ea\u5b9a\u4e49\u7ed3\u675f\u7b26\u53f7<br style=\"outline: 0px;\"  \/>delimiter ; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539\u56de\u539f\u6765\u7684\u5206\u53f7<\/span><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8bed\u53e5\u5757\u5305\u88f9<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">begin<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8bed\u53e5\u5757<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7279\u6b8a\u7684\u6267\u884c<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">1.<\/span> \u53ea\u8981\u6dfb\u52a0\u8bb0\u5f55\uff0c\u5c31\u4f1a\u89e6\u53d1\u7a0b\u5e8f\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">2.<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">Insert<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">on<\/span> duplicate <span style=\"outline: 0px;color: rgb(249, 38, 114);\">key<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">update<\/span> \u8bed\u6cd5\u4f1a\u89e6\u53d1\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5982\u679c\u6ca1\u6709\u91cd\u590d\u8bb0\u5f55\uff0c\u4f1a\u89e6\u53d1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">after<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5982\u679c\u6709\u91cd\u590d\u8bb0\u5f55\u5e76\u66f4\u65b0\uff0c\u4f1a\u89e6\u53d1 before <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">update<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">after<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">update<\/span>;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5982\u679c\u6709\u91cd\u590d\u8bb0\u5f55\u4f46\u662f\u6ca1\u6709\u53d1\u751f\u66f4\u65b0\uff0c\u5219\u89e6\u53d1 before <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">update<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(174, 129, 255);\">3.<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">Replace<\/span> \u8bed\u6cd5 \u5982\u679c\u6709\u8bb0\u5f55\uff0c\u5219\u6267\u884c <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">before<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">after<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">delete<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">after<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">insert<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">SQL\u7f16\u7a0b<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u5c40\u90e8\u53d8\u91cf ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53d8\u91cf\u58f0\u660e<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">declare<\/span> var_name[,...] type [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">default<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">value<\/span>]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8fd9\u4e2a\u8bed\u53e5\u88ab\u7528\u6765\u58f0\u660e\u5c40\u90e8\u53d8\u91cf\u3002\u8981\u7ed9\u53d8\u91cf\u63d0\u4f9b\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff0c\u8bf7\u5305\u542b\u4e00\u4e2a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">default<\/span>\u5b50\u53e5\u3002\u503c\u53ef\u4ee5\u88ab\u6307\u5b9a\u4e3a\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u4e0d\u9700\u8981\u4e3a\u4e00\u4e2a\u5e38\u6570\u3002\u5982\u679c\u6ca1\u6709<span style=\"outline: 0px;color: rgb(249, 38, 114);\">default<\/span>\u5b50\u53e5\uff0c\u521d\u59cb\u503c\u4e3a<span style=\"outline: 0px;color: rgb(174, 129, 255);\">null<\/span>\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8d4b\u503c<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u4f7f\u7528 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span> \u548c <span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> \u8bed\u53e5\u4e3a\u53d8\u91cf\u8d4b\u503c\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u6ce8\u610f\uff1a\u5728\u51fd\u6570\u5185\u662f\u53ef\u4ee5\u4f7f\u7528\u5168\u5c40\u53d8\u91cf\uff08\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u53d8\u91cf\uff09<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u5168\u5c40\u53d8\u91cf ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b9a\u4e49\u3001\u8d4b\u503c<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span> \u8bed\u53e5\u53ef\u4ee5\u5b9a\u4e49\u5e76\u4e3a\u53d8\u91cf\u8d4b\u503c\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span> @<span style=\"outline: 0px;color: rgb(249, 38, 114);\">var<\/span> = <span style=\"outline: 0px;color: rgb(249, 38, 114);\">value<\/span>;<br style=\"outline: 0px;\"  \/>\u4e5f\u53ef\u4ee5\u4f7f\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span>\u8bed\u53e5\u4e3a\u53d8\u91cf\u521d\u59cb\u5316\u5e76\u8d4b\u503c\u3002\u8fd9\u6837\u8981\u6c42<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u8bed\u53e5\u53ea\u80fd\u8fd4\u56de\u4e00\u884c\uff0c\u4f46\u662f\u53ef\u4ee5\u662f\u591a\u4e2a\u5b57\u6bb5\uff0c\u5c31\u610f\u5473\u7740\u540c\u65f6\u4e3a\u591a\u4e2a\u53d8\u91cf\u8fdb\u884c\u8d4b\u503c\uff0c\u53d8\u91cf\u7684\u6570\u91cf\u9700\u8981\u4e0e\u67e5\u8be2\u7684\u5217\u6570\u4e00\u81f4\u3002<br style=\"outline: 0px;\"  \/>\u8fd8\u53ef\u4ee5\u628a\u8d4b\u503c\u8bed\u53e5\u770b\u4f5c\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u901a\u8fc7<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u6267\u884c\u5b8c\u6210\u3002\u6b64\u65f6\u4e3a\u4e86\u907f\u514d=\u88ab\u5f53\u4f5c\u5173\u7cfb\u8fd0\u7b97\u7b26\u770b\u5f85\uff0c\u4f7f\u7528:=\u4ee3\u66ff\u3002\uff08<span style=\"outline: 0px;color: rgb(249, 38, 114);\">set<\/span>\u8bed\u53e5\u53ef\u4ee5\u4f7f\u7528= \u548c :=\uff09\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> @<span style=\"outline: 0px;color: rgb(249, 38, 114);\">var<\/span>:=<span style=\"outline: 0px;color: rgb(174, 129, 255);\">20<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> @v1:=id, @v2=name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> t1 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">limit<\/span> <span style=\"outline: 0px;color: rgb(174, 129, 255);\">1<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> * <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tbl_name <span style=\"outline: 0px;color: rgb(249, 38, 114);\">where<\/span> @<span style=\"outline: 0px;color: rgb(249, 38, 114);\">var<\/span>:=<span style=\"outline: 0px;color: rgb(174, 129, 255);\">30<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> \u53ef\u4ee5\u5c06\u8868\u4e2d\u67e5\u8be2\u83b7\u5f97\u7684\u6570\u636e\u8d4b\u7ed9\u53d8\u91cf\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;-| <span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">max<\/span>(height) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">into<\/span> @max_height <span style=\"outline: 0px;color: rgb(249, 38, 114);\">from<\/span> tb;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u81ea\u5b9a\u4e49\u53d8\u91cf\u540d<\/span><br style=\"outline: 0px;\"  \/>\u4e3a\u4e86\u907f\u514d<span style=\"outline: 0px;color: rgb(249, 38, 114);\">select<\/span>\u8bed\u53e5\u4e2d\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u53d8\u91cf\u4e0e\u7cfb\u7edf\u6807\u8bc6\u7b26\uff08\u901a\u5e38\u662f\u5b57\u6bb5\u540d\uff09\u51b2\u7a81\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u53d8\u91cf\u5728\u53d8\u91cf\u540d\u524d\u4f7f\u7528@\u4f5c\u4e3a\u5f00\u59cb\u7b26\u53f7\u3002<br style=\"outline: 0px;\"  \/>@<span style=\"outline: 0px;color: rgb(249, 38, 114);\">var<\/span>=<span style=\"outline: 0px;color: rgb(174, 129, 255);\">10<\/span>;<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53d8\u91cf\u88ab\u5b9a\u4e49\u540e\uff0c\u5728\u6574\u4e2a\u4f1a\u8bdd\u5468\u671f\u90fd\u6709\u6548\uff08\u767b\u5f55\u5230\u9000\u51fa\uff09<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u63a7\u5236\u7ed3\u6784 ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- if\u8bed\u53e5<\/span><br style=\"outline: 0px;\"  \/>if search_condition then<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;statement_list &nbsp; <br style=\"outline: 0px;\"  \/>[elseif search_condition then<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;statement_list]<br style=\"outline: 0px;\"  \/>...<br style=\"outline: 0px;\"  \/>[else<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;statement_list]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">if<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- case\u8bed\u53e5<\/span><br style=\"outline: 0px;\"  \/>CASE value WHEN [compare-value] THEN result<br style=\"outline: 0px;\"  \/>[WHEN [compare-value] THEN result ...]<br style=\"outline: 0px;\"  \/>[ELSE result]<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">END<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- while\u5faa\u73af<\/span><br style=\"outline: 0px;\"  \/>[begin_label:] while search_condition <span style=\"outline: 0px;color: rgb(249, 38, 114);\">do<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;statement_list<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span> while [end_label];<br style=\"outline: 0px;\"  \/>- \u5982\u679c\u9700\u8981\u5728\u5faa\u73af\u5185\u63d0\u524d\u7ec8\u6b62 while\u5faa\u73af\uff0c\u5219\u9700\u8981\u4f7f\u7528\u6807\u7b7e\uff1b\u6807\u7b7e\u9700\u8981\u6210\u5bf9\u51fa\u73b0\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u9000\u51fa\u5faa\u73af<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u9000\u51fa\u6574\u4e2a\u5faa\u73af leave<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u9000\u51fa\u5f53\u524d\u5faa\u73af iterate<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u901a\u8fc7\u9000\u51fa\u7684\u6807\u7b7e\u51b3\u5b9a\u9000\u51fa\u54ea\u4e2a\u5faa\u73af<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u5185\u7f6e\u51fd\u6570 ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6570\u503c\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/>abs(x) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7edd\u5bf9\u503c abs(-10.9) = 10<\/span><br style=\"outline: 0px;\"  \/>format(x, d) &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u683c\u5f0f\u5316\u5343\u5206\u4f4d\u6570\u503c format(1234567.456, 2) = 1,234,567.46<\/span><br style=\"outline: 0px;\"  \/>ceil(x) &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5411\u4e0a\u53d6\u6574 ceil(10.1) = 11<\/span><br style=\"outline: 0px;\"  \/>floor(x) &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5411\u4e0b\u53d6\u6574 floor (10.1) = 10<\/span><br style=\"outline: 0px;\"  \/>round(x) &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u56db\u820d\u4e94\u5165\u53bb\u6574<\/span><br style=\"outline: 0px;\"  \/>mod(m, n) &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- m%n m mod n \u6c42\u4f59 10%3=1<\/span><br style=\"outline: 0px;\"  \/>pi() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u83b7\u5f97\u5706\u5468\u7387<\/span><br style=\"outline: 0px;\"  \/>pow(m, n) &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- m^n<\/span><br style=\"outline: 0px;\"  \/>sqrt(x) &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7b97\u672f\u5e73\u65b9\u6839<\/span><br style=\"outline: 0px;\"  \/>rand() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u968f\u673a\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">truncate<\/span>(x, d) &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u622a\u53d6d\u4f4d\u5c0f\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u65f6\u95f4\u65e5\u671f\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">now<\/span>(), <span style=\"outline: 0px;color: rgb(249, 38, 114);\">current_timestamp<\/span>(); &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5f53\u524d\u65e5\u671f\u65f6\u95f4<\/span><br style=\"outline: 0px;\"  \/>current_date(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5f53\u524d\u65e5\u671f<\/span><br style=\"outline: 0px;\"  \/>current_time(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5f53\u524d\u65f6\u95f4<\/span><br style=\"outline: 0px;\"  \/>date('yyyy-mm-dd hh:ii:ss'); &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u83b7\u53d6\u65e5\u671f\u90e8\u5206<\/span><br style=\"outline: 0px;\"  \/>time('yyyy-mm-dd hh:ii:ss'); &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u83b7\u53d6\u65f6\u95f4\u90e8\u5206<\/span><br style=\"outline: 0px;\"  \/>date_format('yyyy-mm-dd hh:ii:ss', '%d %y %a %d %m %b %j'); <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u683c\u5f0f\u5316\u65f6\u95f4<\/span><br style=\"outline: 0px;\"  \/>unix_timestamp(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u83b7\u5f97unix\u65f6\u95f4\u6233<\/span><br style=\"outline: 0px;\"  \/>from_unixtime(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4ece\u65f6\u95f4\u6233\u83b7\u5f97\u65f6\u95f4<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b57\u7b26\u4e32\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/>length(string) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- string\u957f\u5ea6\uff0c\u5b57\u8282<\/span><br style=\"outline: 0px;\"  \/>char_length(string) &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- string\u7684\u5b57\u7b26\u4e2a\u6570<\/span><br style=\"outline: 0px;\"  \/>substring(str, position [,length]) &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4ecestr\u7684position\u5f00\u59cb,\u53d6length\u4e2a\u5b57\u7b26<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">replace<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">str<\/span> ,search_str ,replace_str) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5728str\u4e2d\u7528replace_str\u66ff\u6362search_str<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">instr<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span> ,<span style=\"outline: 0px;color: rgb(249, 38, 114);\">substring<\/span>) &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8fd4\u56desubstring\u9996\u6b21\u5728string\u4e2d\u51fa\u73b0\u7684\u4f4d\u7f6e<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">concat<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span> [,...]) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8fde\u63a5\u5b57\u4e32<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">charset<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">str<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8fd4\u56de\u5b57\u4e32\u5b57\u7b26\u96c6<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">lcase<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8f6c\u6362\u6210\u5c0f\u5199<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">left<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>, length) &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4ecestring2\u4e2d\u7684\u5de6\u8fb9\u8d77\u53d6length\u4e2a\u5b57\u7b26<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">load_file<\/span>(file_name) &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4ece\u6587\u4ef6\u8bfb\u53d6\u5185\u5bb9<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">locate<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">substring<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span> [,start_position]) <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u540cinstr,\u4f46\u53ef\u6307\u5b9a\u5f00\u59cb\u4f4d\u7f6e<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">lpad<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>, length, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">pad<\/span>) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u91cd\u590d\u7528pad\u52a0\u5728string\u5f00\u5934,\u76f4\u5230\u5b57\u4e32\u957f\u5ea6\u4e3alength<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">ltrim<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53bb\u9664\u524d\u7aef\u7a7a\u683c<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">repeat<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">count<\/span>) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u91cd\u590dcount\u6b21<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">rpad<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>, length, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">pad<\/span>) &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\u5728str\u540e\u7528pad\u8865\u5145,\u76f4\u5230\u957f\u5ea6\u4e3alength<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">rtrim<\/span>(<span style=\"outline: 0px;color: rgb(249, 38, 114);\">string<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53bb\u9664\u540e\u7aef\u7a7a\u683c<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">strcmp<\/span>(string1 ,string2) &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u9010\u5b57\u7b26\u6bd4\u8f83\u4e24\u5b57\u4e32\u5927\u5c0f<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6d41\u7a0b\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">case<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">when<\/span> [condition] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">then<\/span> result [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">when<\/span> [condition] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">then<\/span> result ...] [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">else<\/span> result] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span> &nbsp; \u591a\u5206\u652f<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">if<\/span>(expr1,expr2,expr3) &nbsp;\u53cc\u5206\u652f\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u805a\u5408\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">count<\/span>()<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">sum<\/span>();<br style=\"outline: 0px;\"  \/>max();<br style=\"outline: 0px;\"  \/>min();<br style=\"outline: 0px;\"  \/>avg();<br style=\"outline: 0px;\"  \/>group_concat()<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5176\u4ed6\u5e38\u7528\u51fd\u6570<\/span><br style=\"outline: 0px;\"  \/>md5();<br style=\"outline: 0px;\"  \/>default();<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u5b58\u50a8\u51fd\u6570\uff0c\u81ea\u5b9a\u4e49\u51fd\u6570 ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u65b0\u5efa<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FUNCTION<\/span> function_name (\u53c2\u6570\u5217\u8868) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">RETURNS<\/span> \u8fd4\u56de\u503c\u7c7b\u578b<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp; &nbsp; &nbsp;\u51fd\u6570\u4f53<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u51fd\u6570\u540d\uff0c\u5e94\u8be5\u5408\u6cd5\u7684\u6807\u8bc6\u7b26\uff0c\u5e76\u4e14\u4e0d\u5e94\u8be5\u4e0e\u5df2\u6709\u7684\u5173\u952e\u5b57\u51b2\u7a81\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e00\u4e2a\u51fd\u6570\u5e94\u8be5\u5c5e\u4e8e\u67d0\u4e2a\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528db_name.funciton_name\u7684\u5f62\u5f0f\u6267\u884c\u5f53\u524d\u51fd\u6570\u6240\u5c5e\u6570\u636e\u5e93\uff0c\u5426\u5219\u4e3a\u5f53\u524d\u6570\u636e\u5e93\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53c2\u6570\u90e8\u5206\uff0c\u7531<span style=\"outline: 0px;color: rgb(230, 219, 116);\">\"\u53c2\u6570\u540d\"<\/span>\u548c<span style=\"outline: 0px;color: rgb(230, 219, 116);\">\"\u53c2\u6570\u7c7b\u578b\"<\/span>\u7ec4\u6210\u3002\u591a\u4e2a\u53c2\u6570\u7528\u9017\u53f7\u9694\u5f00\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u51fd\u6570\u4f53\u7531\u591a\u6761\u53ef\u7528\u7684mysql\u8bed\u53e5\uff0c\u6d41\u7a0b\u63a7\u5236\uff0c\u53d8\u91cf\u58f0\u660e\u7b49\u8bed\u53e5\u6784\u6210\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u591a\u6761\u8bed\u53e5\u5e94\u8be5\u4f7f\u7528 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">begin<\/span>...<span style=\"outline: 0px;color: rgb(249, 38, 114);\">end<\/span> \u8bed\u53e5\u5757\u5305\u542b\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u4e00\u5b9a\u8981\u6709 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">return<\/span> \u8fd4\u56de\u503c\u8bed\u53e5\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FUNCTION<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">IF<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXISTS<\/span>] function_name;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FUNCTION<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">STATUS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">LIKE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'partten'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FUNCTION<\/span> function_name;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4fee\u6539<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FUNCTION<\/span> function_name \u51fd\u6570\u9009\u9879<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">--\/\/ \u5b58\u50a8\u8fc7\u7a0b\uff0c\u81ea\u5b9a\u4e49\u529f\u80fd ----------<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5b9a\u4e49<\/span><br style=\"outline: 0px;\"  \/>\u5b58\u50a8\u5b58\u50a8\u8fc7\u7a0b \u662f\u4e00\u6bb5\u4ee3\u7801\uff08\u8fc7\u7a0b\uff09\uff0c\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684<span style=\"outline: 0px;color: rgb(249, 38, 114);\">sql<\/span>\u7ec4\u6210\u3002<br style=\"outline: 0px;\"  \/>\u4e00\u4e2a\u5b58\u50a8\u8fc7\u7a0b\u901a\u5e38\u7528\u4e8e\u5b8c\u6210\u4e00\u6bb5\u4e1a\u52a1\u903b\u8f91\uff0c\u4f8b\u5982\u62a5\u540d\uff0c\u4ea4\u73ed\u8d39\uff0c\u8ba2\u5355\u5165\u5e93\u7b49\u3002<br style=\"outline: 0px;\"  \/>\u800c\u4e00\u4e2a\u51fd\u6570\u901a\u5e38\u4e13\u6ce8\u4e0e\u67d0\u4e2a\u529f\u80fd\uff0c\u89c6\u4e3a\u5176\u4ed6\u7a0b\u5e8f\u670d\u52a1\u7684\uff0c\u9700\u8981\u5728\u5176\u4ed6\u8bed\u53e5\u4e2d\u8c03\u7528\u51fd\u6570\u624d\u53ef\u4ee5\uff0c\u800c\u5b58\u50a8\u8fc7\u7a0b\u4e0d\u80fd\u88ab\u5176\u4ed6\u8c03\u7528\uff0c\u662f\u81ea\u5df1\u6267\u884c \u901a\u8fc7<span style=\"outline: 0px;color: rgb(249, 38, 114);\">call<\/span>\u6267\u884c\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PROCEDURE<\/span> sp_name (\u53c2\u6570\u5217\u8868)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8fc7\u7a0b\u4f53<br style=\"outline: 0px;\"  \/>\u53c2\u6570\u5217\u8868\uff1a\u4e0d\u540c\u4e8e\u51fd\u6570\u7684\u53c2\u6570\u5217\u8868\uff0c\u9700\u8981\u6307\u660e\u53c2\u6570\u7c7b\u578b<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">IN<\/span>\uff0c\u8868\u793a\u8f93\u5165\u578b<br style=\"outline: 0px;\"  \/>OUT\uff0c\u8868\u793a\u8f93\u51fa\u578b<br style=\"outline: 0px;\"  \/>INOUT\uff0c\u8868\u793a\u6df7\u5408\u578b<br style=\"outline: 0px;\"  \/>\u6ce8\u610f\uff0c\u6ca1\u6709\u8fd4\u56de\u503c\u3002<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">\/* \u5b58\u50a8\u8fc7\u7a0b *\/<\/span> <span style=\"outline: 0px;color: rgb(117, 113, 94);\">------------------<\/span><br style=\"outline: 0px;\"  \/>\u5b58\u50a8\u8fc7\u7a0b\u662f\u4e00\u6bb5\u53ef\u6267\u884c\u6027\u4ee3\u7801\u7684\u96c6\u5408\u3002\u76f8\u6bd4\u51fd\u6570\uff0c\u66f4\u504f\u5411\u4e8e\u4e1a\u52a1\u903b\u8f91\u3002<br style=\"outline: 0px;\"  \/>\u8c03\u7528\uff1a<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CALL<\/span> \u8fc7\u7a0b\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6ce8\u610f<\/span><br style=\"outline: 0px;\"  \/>- \u6ca1\u6709\u8fd4\u56de\u503c\u3002<br style=\"outline: 0px;\"  \/>- \u53ea\u80fd\u5355\u72ec\u8c03\u7528\uff0c\u4e0d\u53ef\u5939\u6742\u5728\u5176\u4ed6\u8bed\u53e5\u4e2d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u53c2\u6570<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">IN<\/span>|OUT|INOUT \u53c2\u6570\u540d \u6570\u636e\u7c7b\u578b<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">IN<\/span> &nbsp; &nbsp; &nbsp;\u8f93\u5165\uff1a\u5728\u8c03\u7528\u8fc7\u7a0b\u4e2d\uff0c\u5c06\u6570\u636e\u8f93\u5165\u5230\u8fc7\u7a0b\u4f53\u5185\u90e8\u7684\u53c2\u6570<br style=\"outline: 0px;\"  \/>OUT &nbsp; &nbsp; \u8f93\u51fa\uff1a\u5728\u8c03\u7528\u8fc7\u7a0b\u4e2d\uff0c\u5c06\u8fc7\u7a0b\u4f53\u5904\u7406\u5b8c\u7684\u7ed3\u679c\u8fd4\u56de\u5230\u5ba2\u6237\u7aef<br style=\"outline: 0px;\"  \/>INOUT &nbsp; \u8f93\u5165\u8f93\u51fa\uff1a\u65e2\u53ef\u8f93\u5165\uff0c\u4e5f\u53ef\u8f93\u51fa<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8bed\u6cd5<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PROCEDURE<\/span> \u8fc7\u7a0b\u540d (\u53c2\u6570\u5217\u8868)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">BEGIN<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u8fc7\u7a0b\u4f53<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">END<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u7528\u6237\u548c\u6743\u9650\u7ba1\u7406<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- root\u5bc6\u7801\u91cd\u7f6e<\/span><br style=\"outline: 0px;\"  \/>1. \u505c\u6b62MySQL\u670d\u52a1<br style=\"outline: 0px;\"  \/>2. &nbsp;[Linux] \/usr\/local\/mysql\/bin\/safe_mysqld <span style=\"outline: 0px;color: rgb(117, 113, 94);\">--skip-grant-tables &amp;<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;[Windows] mysqld <span style=\"outline: 0px;color: rgb(117, 113, 94);\">--skip-grant-tables<\/span><br style=\"outline: 0px;\"  \/>3. <span style=\"outline: 0px;color: rgb(249, 38, 114);\">use<\/span> mysql;<br style=\"outline: 0px;\"  \/>4. <span style=\"outline: 0px;color: rgb(249, 38, 114);\">UPDATE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">`user`<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>=<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>(<span style=\"outline: 0px;color: rgb(230, 219, 116);\">\"\u5bc6\u7801\"<\/span>) <span style=\"outline: 0px;color: rgb(249, 38, 114);\">WHERE<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">`user`<\/span> = <span style=\"outline: 0px;color: rgb(230, 219, 116);\">\"root\"<\/span>;<br style=\"outline: 0px;\"  \/>5. <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FLUSH<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIVILEGES<\/span>;<br style=\"outline: 0px;\"  \/>\u7528\u6237\u4fe1\u606f\u8868\uff1amysql.user<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5237\u65b0\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">FLUSH<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIVILEGES<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u589e\u52a0\u7528\u6237<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">USER<\/span> \u7528\u6237\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IDENTIFIED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>] \u5bc6\u7801(\u5b57\u7b26\u4e32)<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5fc5\u987b\u62e5\u6709mysql\u6570\u636e\u5e93\u7684\u5168\u5c40<span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">USER<\/span>\u6743\u9650\uff0c\u6216\u62e5\u6709<span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span>\u6743\u9650\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u53ea\u80fd\u521b\u5efa\u7528\u6237\uff0c\u4e0d\u80fd\u8d4b\u4e88\u6743\u9650\u3002<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u7528\u6237\u540d\uff0c\u6ce8\u610f\u5f15\u53f7\uff1a\u5982 <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'user_name'<\/span>@<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'192.168.1.1'<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5bc6\u7801\u4e5f\u9700\u5f15\u53f7\uff0c\u7eaf\u6570\u5b57\u5bc6\u7801\u4e5f\u8981\u52a0\u5f15\u53f7<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u8981\u5728\u7eaf\u6587\u672c\u4e2d\u6307\u5b9a\u5bc6\u7801\uff0c\u9700\u5ffd\u7565<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>\u5173\u952e\u8bcd\u3002\u8981\u628a\u5bc6\u7801\u6307\u5b9a\u4e3a\u7531<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>()\u51fd\u6570\u8fd4\u56de\u7684\u6df7\u7f16\u503c\uff0c\u9700\u5305\u542b\u5173\u952e\u5b57<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u91cd\u547d\u540d\u7528\u6237<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">RENAME<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">USER<\/span> old_user <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> new_user<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8bbe\u7f6e\u5bc6\u7801<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span> = <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>(<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u5bc6\u7801'<\/span>) &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e3a\u5f53\u524d\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SET<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOR<\/span> \u7528\u6237\u540d = <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>(<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'\u5bc6\u7801'<\/span>) <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u4e3a\u6307\u5b9a\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5220\u9664\u7528\u6237<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">USER<\/span> \u7528\u6237\u540d<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5206\u914d\u6743\u9650\/\u6dfb\u52a0\u7528\u6237<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> \u6743\u9650\u5217\u8868 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> \u8868\u540d <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> \u7528\u6237\u540d [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">IDENTIFIED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PASSWORD<\/span>] <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'password'<\/span>]<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- <span style=\"outline: 0px;color: rgb(249, 38, 114);\">all<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">privileges<\/span> \u8868\u793a\u6240\u6709\u6743\u9650<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- *.* \u8868\u793a\u6240\u6709\u5e93\u7684\u6240\u6709\u8868<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;- \u5e93\u540d.\u8868\u540d \u8868\u793a\u67d0\u5e93\u4e0b\u9762\u7684\u67d0\u8868<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIVILEGES<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">`pms`<\/span>.* <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TO<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pms'<\/span>@<span style=\"outline: 0px;color: rgb(230, 219, 116);\">'%'<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">IDENTIFIED<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">BY<\/span> <span style=\"outline: 0px;color: rgb(230, 219, 116);\">'pms0817'<\/span>;<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANTS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOR<\/span> \u7528\u6237\u540d<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u67e5\u770b\u5f53\u524d\u7528\u6237\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANTS<\/span>; \u6216 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANTS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOR<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CURRENT_USER<\/span>; \u6216 <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANTS<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FOR<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CURRENT_USER<\/span>();<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u64a4\u6d88\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/>REVOKE \u6743\u9650\u5217\u8868 ON \u8868\u540d FROM \u7528\u6237\u540d<br style=\"outline: 0px;\"  \/>REVOKE ALL PRIVILEGES, <span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">OPTION<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FROM<\/span> \u7528\u6237\u540d &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u64a4\u9500\u6240\u6709\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6743\u9650\u5c42\u7ea7<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8981\u4f7f\u7528GRANT\u6216REVOKE\uff0c\u60a8\u5fc5\u987b\u62e5\u6709GRANT OPTION\u6743\u9650\uff0c\u5e76\u4e14\u60a8\u5fc5\u987b\u7528\u4e8e\u60a8\u6b63\u5728\u6388\u4e88\u6216\u64a4\u9500\u7684\u6743\u9650\u3002<\/span><br style=\"outline: 0px;\"  \/>\u5168\u5c40\u5c42\u7ea7\uff1a\u5168\u5c40\u6743\u9650\u9002\u7528\u4e8e\u4e00\u4e2a\u7ed9\u5b9a\u670d\u52a1\u5668\u4e2d\u7684\u6240\u6709\u6570\u636e\u5e93\uff0cmysql.<span style=\"outline: 0px;color: rgb(249, 38, 114);\">user<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> *.*\u548c <span style=\"outline: 0px;color: rgb(249, 38, 114);\">REVOKE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> *.*\u53ea\u6388\u4e88\u548c\u64a4\u9500\u5168\u5c40\u6743\u9650\u3002<br style=\"outline: 0px;\"  \/>\u6570\u636e\u5e93\u5c42\u7ea7\uff1a\u6570\u636e\u5e93\u6743\u9650\u9002\u7528\u4e8e\u4e00\u4e2a\u7ed9\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u76ee\u6807\uff0cmysql.db, mysql.host<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> db_name.*\u548c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">REVOKE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> db_name.*\u53ea\u6388\u4e88\u548c\u64a4\u9500\u6570\u636e\u5e93\u6743\u9650\u3002<br style=\"outline: 0px;\"  \/>\u8868\u5c42\u7ea7\uff1a\u8868\u6743\u9650\u9002\u7528\u4e8e\u4e00\u4e2a\u7ed9\u5b9a\u8868\u4e2d\u7684\u6240\u6709\u5217\uff0cmysql.talbes_priv<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> db_name.tbl_name\u548c<span style=\"outline: 0px;color: rgb(249, 38, 114);\">REVOKE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">ON<\/span> db_name.tbl_name\u53ea\u6388\u4e88\u548c\u64a4\u9500\u8868\u6743\u9650\u3002<br style=\"outline: 0px;\"  \/>\u5217\u5c42\u7ea7\uff1a\u5217\u6743\u9650\u9002\u7528\u4e8e\u4e00\u4e2a\u7ed9\u5b9a\u8868\u4e2d\u7684\u5355\u4e00\u5217\uff0cmysql.columns_priv<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5f53\u4f7f\u7528<span style=\"outline: 0px;color: rgb(249, 38, 114);\">REVOKE<\/span>\u65f6\uff0c\u60a8\u5fc5\u987b\u6307\u5b9a\u4e0e\u88ab\u6388\u6743\u5217\u76f8\u540c\u7684\u5217\u3002<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6743\u9650\u5217\u8868<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALL<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">PRIVILEGES<\/span>] &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u8bbe\u7f6e\u9664GRANT OPTION\u4e4b\u5916\u7684\u6240\u6709\u7b80\u5355\u6743\u9650<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528ALTER TABLE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">ALTER<\/span> ROUTINE &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u66f4\u6539\u6216\u53d6\u6d88\u5df2\u5b58\u50a8\u7684\u5b50\u7a0b\u5e8f<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CREATE TABLE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> ROUTINE &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u521b\u5efa\u5df2\u5b58\u50a8\u7684\u5b50\u7a0b\u5e8f<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TEMPORARY<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span> &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CREATE TEMPORARY TABLE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">USER<\/span> &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CREATE USER, DROP USER, RENAME USER\u548cREVOKE ALL PRIVILEGES\u3002<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CREATE<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CREATE VIEW<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">DELETE<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528DELETE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">DROP<\/span> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528DROP TABLE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXECUTE<\/span> &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u7528\u6237\u8fd0\u884c\u5df2\u5b58\u50a8\u7684\u5b50\u7a0b\u5e8f<\/span><br style=\"outline: 0px;\"  \/>FILE &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528SELECT...INTO OUTFILE\u548cLOAD DATA INFILE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">INDEX<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CREATE INDEX\u548cDROP INDEX<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">INSERT<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528INSERT<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLES<\/span> &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u5bf9\u60a8\u62e5\u6709SELECT\u6743\u9650\u7684\u8868\u4f7f\u7528LOCK TABLES<\/span><br style=\"outline: 0px;\"  \/>PROCESS &nbsp; &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528SHOW FULL PROCESSLIST<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">REFERENCES<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u672a\u88ab\u5b9e\u65bd<\/span><br style=\"outline: 0px;\"  \/>RELOAD &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528FLUSH<\/span><br style=\"outline: 0px;\"  \/>REPLICATION CLIENT &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u7528\u6237\u8be2\u95ee\u4ece\u5c5e\u670d\u52a1\u5668\u6216\u4e3b\u670d\u52a1\u5668\u7684\u5730\u5740<\/span><br style=\"outline: 0px;\"  \/>REPLICATION <span style=\"outline: 0px;color: rgb(249, 38, 114);\">SLAVE<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u7528\u4e8e\u590d\u5236\u578b\u4ece\u5c5e\u670d\u52a1\u5668\uff08\u4ece\u4e3b\u670d\u52a1\u5668\u4e2d\u8bfb\u53d6\u4e8c\u8fdb\u5236\u65e5\u5fd7\u4e8b\u4ef6\uff09<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SELECT<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528SELECT<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">DATABASES<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u663e\u793a\u6240\u6709\u6570\u636e\u5e93<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">SHOW<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">VIEW<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528SHOW CREATE VIEW<\/span><br style=\"outline: 0px;\"  \/>SHUTDOWN &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528mysqladmin shutdown<\/span><br style=\"outline: 0px;\"  \/>SUPER &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528CHANGE MASTER, KILL, PURGE MASTER LOGS\u548cSET GLOBAL\u8bed\u53e5\uff0cmysqladmin debug\u547d\u4ee4\uff1b\u5141\u8bb8\u60a8\u8fde\u63a5\uff08\u4e00\u6b21\uff09\uff0c\u5373\u4f7f\u5df2\u8fbe\u5230max_connections\u3002<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">UPDATE<\/span> &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u4f7f\u7528UPDATE<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">USAGE<\/span> &nbsp; <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u201c\u65e0\u6743\u9650\u201d\u7684\u540c\u4e49\u8bcd<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">GRANT<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">OPTION<\/span> &nbsp; &nbsp;<span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5141\u8bb8\u6388\u4e88\u6743\u9650<\/span><\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u8868\u7ef4\u62a4<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\"><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u5206\u6790\u548c\u5b58\u50a8\u8868\u7684\u5173\u952e\u5b57\u5206\u5e03<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">ANALYZE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCAL<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NO_WRITE_TO_BINLOG<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> \u8868\u540d ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u68c0\u67e5\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\u662f\u5426\u6709\u9519\u8bef<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHECK<\/span> <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ... [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">option<\/span>] ...<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">option<\/span> = {<span style=\"outline: 0px;color: rgb(249, 38, 114);\">QUICK<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">FAST<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">MEDIUM<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">EXTENDED<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">CHANGED<\/span>}<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6574\u7406\u6570\u636e\u6587\u4ef6\u7684\u788e\u7247<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(249, 38, 114);\">OPTIMIZE<\/span> [<span style=\"outline: 0px;color: rgb(249, 38, 114);\">LOCAL<\/span> | <span style=\"outline: 0px;color: rgb(249, 38, 114);\">NO_WRITE_TO_BINLOG<\/span>] <span style=\"outline: 0px;color: rgb(249, 38, 114);\">TABLE<\/span> tbl_name [, tbl_name] ...<\/code><\/pre>\n<p style=\"margin-bottom: 0px;outline: 0px;\">\u6742\u9879<\/p>\n<pre style=\"margin-top: 1.2em;margin-bottom: 1.2em;outline: 0px;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.85em;line-height: 1.2em;\"><code style=\"margin-right: 0.15em;margin-left: 0.15em;padding: 0.5em;outline: 0px;white-space: pre-wrap;font-size: 0.85em;font-family: Consolas, Inconsolata, Courier, monospace;overflow: auto;border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);background: rgb(35, 36, 31);text-size-adjust: none;color: rgb(248, 248, 242);display: block !important;\">1. \u53ef\u7528\u53cd\u5f15\u53f7\uff08`\uff09\u4e3a\u6807\u8bc6\u7b26\uff08\u5e93\u540d\u3001\u8868\u540d\u3001\u5b57\u6bb5\u540d\u3001\u7d22\u5f15\u3001\u522b\u540d\uff09\u5305\u88f9\uff0c\u4ee5\u907f\u514d\u4e0e\u5173\u952e\u5b57\u91cd\u540d\uff01\u4e2d\u6587\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u6807\u8bc6\u7b26\uff01<br style=\"outline: 0px;\"  \/>2. \u6bcf\u4e2a\u5e93\u76ee\u5f55\u5b58\u5728\u4e00\u4e2a\u4fdd\u5b58\u5f53\u524d\u6570\u636e\u5e93\u7684\u9009\u9879\u6587\u4ef6db.opt\u3002<br style=\"outline: 0px;\"  \/>3. \u6ce8\u91ca\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5355\u884c\u6ce8\u91ca # \u6ce8\u91ca\u5185\u5bb9<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u591a\u884c\u6ce8\u91ca <span style=\"outline: 0px;color: rgb(117, 113, 94);\">\/* \u6ce8\u91ca\u5185\u5bb9 *\/<\/span><br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5355\u884c\u6ce8\u91ca <span style=\"outline: 0px;color: rgb(117, 113, 94);\">-- \u6ce8\u91ca\u5185\u5bb9 &nbsp; &nbsp; (\u6807\u51c6SQL\u6ce8\u91ca\u98ce\u683c\uff0c\u8981\u6c42\u53cc\u7834\u6298\u53f7\u540e\u52a0\u4e00\u7a7a\u683c\u7b26\uff08\u7a7a\u683c\u3001TAB\u3001\u6362\u884c\u7b49\uff09)<\/span><br style=\"outline: 0px;\"  \/>4. \u6a21\u5f0f\u901a\u914d\u7b26\uff1a<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;_ &nbsp; \u4efb\u610f\u5355\u4e2a\u5b57\u7b26<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;% &nbsp; \u4efb\u610f\u591a\u4e2a\u5b57\u7b26\uff0c\u751a\u81f3\u5305\u62ec\u96f6\u5b57\u7b26<br style=\"outline: 0px;\"  \/> &nbsp; &nbsp;\u5355\u5f15\u53f7\u9700\u8981\u8fdb\u884c\u8f6c\u4e49 '<br style=\"outline: 0px;\"  \/>5. CMD\u547d\u4ee4\u884c\u5185\u7684\u8bed\u53e5\u7ed3\u675f\u7b26\u53ef\u4ee5\u4e3a \";\", \"G\", \"g\"\uff0c\u4ec5\u5f71\u54cd\u663e\u793a\u7ed3\u679c\u3002\u5176\u4ed6\u5730\u65b9\u8fd8\u662f\u7528\u5206\u53f7\u7ed3\u675f\u3002delimiter \u53ef\u4fee\u6539\u5f53\u524d\u5bf9\u8bdd\u7684\u8bed\u53e5\u7ed3\u675f\u7b26\u3002<br style=\"outline: 0px;\"  \/>6. SQL\u5bf9\u5927\u5c0f\u5199\u4e0d\u654f\u611f<br style=\"outline: 0px;\"  \/>7. \u6e05\u9664\u5df2\u6709\u8bed\u53e5\uff1ac<\/code><\/pre>\n<p><br  \/><\/p>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 \u6f6e\u6c55IT\u667a\u5e93              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>Windows\u670d\u52a1 &#8212; \u542f\u52a8MySQL &nbsp; &nbsp;net start mysql&#8211; \u521b\u5efaWindows\u670d\u52a1 &#038; &#8230;<\/p>\n","protected":false},"author":1,"featured_media":542,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[3,8],"tags":[],"class_list":["post-543","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","category-spring-cloud"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355-150x150.jpeg","content_first_image":null,"post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355.jpeg","post_frist_image":null,"post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010522355.jpeg","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"MySQL","post_date":"2023-05-26","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":307,"next_post_id":309,"next_post_title":"SpringBoot\u6574\u5408Canal+RabbitMQ\u76d1\u542c\u6570\u636e\u53d8\u66f4~","previous_post_id":359,"previous_post_title":"SQL \u4f18\u5316\u5b9e\u8df5","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=543"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/543\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/542"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}