﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-JafeLee-随笔分类-Database</title><link>http://www.blogjava.net/JafeLee/category/25735.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 21 Sep 2007 17:52:35 GMT</lastBuildDate><pubDate>Fri, 21 Sep 2007 17:52:35 GMT</pubDate><ttl>60</ttl><item><title>MySQL命令 (9) -- 备份和恢复</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/21/146817.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Fri, 21 Sep 2007 13:47:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/21/146817.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/146817.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/21/146817.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/146817.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/146817.html</trackback:ping><description><![CDATA[1、备份整个数据库（估计也是最土的方法了）<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">mysqldump </span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">user=user --host=host --port=port </span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">password=password dbname &gt; filename.sql</span></div><ul><li>如果没有指定 host和port参数，则客户端会连向localhost的mysql server。</li><li>如果要备份多个数据库，则可添加参数 --database, 例如 --databases db1 db2</li><li>要备份数据库需要必要权限</li></ul>2、备份整个数据库相应的恢复方法：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">mysql </span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">user=user --host=host --port=port --password=password dbname &lt; filename.sql</span></div><br />（未完待续，尚在研究中~)<br /><img src ="http://www.blogjava.net/JafeLee/aggbug/146817.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-21 21:47 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/21/146817.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (8) -- 客服端命令行</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/21/146589.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Fri, 21 Sep 2007 13:46:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/21/146589.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/146589.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/21/146589.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/146589.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/146589.html</trackback:ping><description><![CDATA[1、连接到服务器：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">mysql </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">-h host</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">-u user_name</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">-p</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">db_name]</span></div>注意：<br /><ul><li> db_name 表示默认数据库，相当与连接成功后的use db_name。</li><li>-p 表示密码选项，当有该选项是，mysql会弹出密码输入对话框，否则mysql将以匿名形式向服务器发送登录请求</li><li>也可以在-p后直接加上密码，mysql将直接向服务器发送登录请求，注意密码与-p之间不能有空格</li></ul>2、批量处理命令：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">echo </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">SELECT 1 + 1</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> mysql </span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">u some_user </span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">p</span></div>mysql命令行也支持重定向：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">mysql </span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">u </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">p </span><span style="color: rgb(128, 128, 128);">&lt;</span><span style="color: rgb(0, 0, 0);"> input_file </span><span style="color: rgb(128, 128, 128);">&gt;</span><span style="color: rgb(0, 0, 0);"> output_file</span></div><br />3、如果要清除当前行的命令在命令后添加 \c，例如：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">DROP</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">DATABASE</span><span style="color: rgb(0, 0, 0);"> foo;\c</span></div>(未完待续，因不是很重要，暂不研究）<br /><img src ="http://www.blogjava.net/JafeLee/aggbug/146589.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-21 21:46 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/21/146589.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (7) -- 用户管理</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/19/146292.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Wed, 19 Sep 2007 11:19:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/19/146292.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/146292.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/19/146292.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/146292.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/146292.html</trackback:ping><description><![CDATA[1、创建一个新用户：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);"> IDENTIFIED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">password</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>例如：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> test</span><span style="color: rgb(0, 128, 0);">@localhost</span><span style="color: rgb(0, 0, 0);"> IDENTIFIED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">localhost</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>以及<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> test</span><span style="color: rgb(0, 128, 0);">@192</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0); font-weight: bold;">76.23</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);"> IDENTIFIED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">remote</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>上面两个例子创建的用户名名字虽然相同，但是两个的差别确实相当大的，例如，第一个test只能从本机登录，第二个test只能从ip为 192.76.23.10的机器登录。MySQL服务器通过两者的password来区别他们。<br /><br />2、删除一个用户：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">DROP</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);">;</span></div>如果没指明host，则默认为 drop user user@"%"，你必须在此前创建相应的用户，否则会引发错误。<br /><br />3、重命名一个用户：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">RENAME </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> old_user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> new_user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);">;</span></div>实际上该命令既可以修改username，也可以修改host~<br /><br />4、使用通配符 % :<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">test</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">@</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">192.76.23.%</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">USER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">test</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">@</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">%</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div><br />5、获取有关用户和数据库关系的信息：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> Db </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> db <br /></span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">User</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">user</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">AND</span><span style="color: rgb(0, 0, 0);"> Host </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">host</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /><br /><br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> Table_name </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> tables_priv<br /></span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">User</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">user</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">AND</span><span style="color: rgb(0, 0, 0);"> Host </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">host</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">AND</span><span style="color: rgb(0, 0, 0);"> Db </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">db</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span></div>注意：表 db在数据库mysql中，该数据库还包括很多其他信息。<br /><br />6、设置密码：<br />设置自己的密码：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SET</span><span style="color: rgb(0, 0, 0);"> PASSWORD </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> PASSWORD(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">password</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);</span></div><br />设置别人的密码（必须有管理权限）：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SET</span><span style="color: rgb(0, 0, 0);"> PASSWORD </span><span style="color: rgb(0, 0, 255);">FOR</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> PASSWORD(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">password</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);</span></div><br />7、赋予用户一定权限：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">GRANT</span><span style="color: rgb(0, 0, 0);"> </span><i><span style="color: rgb(0, 0, 255);">privileges</span><span style="color: rgb(0, 0, 0);"> </span></i><span style="color: rgb(0, 0, 255);">ON</span><span style="color: rgb(0, 0, 0);"> <i>db.</i></span><i><span style="color: rgb(0, 0, 255);">table</span></i><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);"><br />IDENTIFIED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">password</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>收回用户权限：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">REVOKE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">privileges</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">ON</span><span style="color: rgb(0, 0, 0);"> db.</span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">user</span><span style="color: rgb(0, 128, 0);">@host</span><span style="color: rgb(0, 0, 0);"><br />IDENTIFIED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">password</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div><br /><img src ="http://www.blogjava.net/JafeLee/aggbug/146292.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-19 19:19 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/19/146292.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (6) -- 修改数据</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/18/146168.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Tue, 18 Sep 2007 10:31:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/18/146168.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/146168.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/18/146168.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/146168.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/146168.html</trackback:ping><description><![CDATA[1、update 基本用法：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">UPDATE</span><span style="color: rgb(0, 0, 0);"> book </span><span style="color: rgb(0, 0, 255);">SET</span><span style="color: rgb(0, 0, 0);"> cond </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">mint</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>一般不要这么用，因为这会将一个column的所有行的cond设为 'mint'。<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">UPDATE</span><span style="color: rgb(0, 0, 0);"> book </span><span style="color: rgb(0, 0, 255);">SET</span><span style="color: rgb(0, 0, 0);"> author </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> "Theodor Geisel" </span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> author </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> "Dr. Seuss";<br /></span></div><br />2、在update中使用公式：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">UPDATE</span><span style="color: rgb(0, 0, 0);"> loan<br /></span><span style="color: rgb(0, 0, 255);">SET</span><span style="color: rgb(0, 0, 0);"> date_lent </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> DATE_ADD(date_lent, INTERVAL </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">YEAR</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> date_lent </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">2005-01-01</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span></div><br />3、删除行：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">DELETE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> book </span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> cond </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">poor</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;</span></div>如果省略 where 语句，则会删除掉所有列<br /><br />4、从多个表中删除：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">DELETE</span><span style="color: rgb(0, 0, 0);"> book, loan    # tables </span><span style="color: rgb(0, 0, 255);">to</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">delete</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> book, loan    # tables </span><span style="color: rgb(0, 0, 255);">to</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">use</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> clause<br /></span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> book.book_id </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> loan.book_id<br /></span><span style="color: rgb(128, 128, 128);">AND</span><span style="color: rgb(0, 0, 0);"> book.cond </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">poor</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span></div><br /><img src ="http://www.blogjava.net/JafeLee/aggbug/146168.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-18 18:31 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/18/146168.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (5) -- 获取数据</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/14/145044.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Fri, 14 Sep 2007 02:45:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/14/145044.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/145044.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/14/145044.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/145044.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/145044.html</trackback:ping><description><![CDATA[1、限制返回的行数：<br />（1）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> author </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> book LIMIT </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);">;</span></div>该命令将返回前两行记录<br />（2）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> author </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> book LIMIT </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);">;</span></div>该命令返回两条记录，但是该记录是从第二条记录开始算起（注意,行数计数的起点是从0而不是1开始的，这跟Java中的数组很象)<br /><br />2、排序返回的结果：（order by)<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> name, birth </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> pet </span><span style="color: rgb(0, 0, 255);">ORDER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> birth;<br /></span></div><br />返回的序列以升序（默认）形式排列，如果想降序排列，则需要这样：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> name, birth </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> pet </span><span style="color: rgb(0, 0, 255);">ORDER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> birth </span><span style="color: rgb(0, 0, 255);">DESC</span><span style="color: rgb(0, 0, 0);">;<br /></span></div><br />你也可以显式指明按升序方式排列：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> name, birth </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> pet </span><span style="color: rgb(0, 0, 255);">ORDER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> birth </span><span style="color: rgb(0, 0, 255);">ASC</span><span style="color: rgb(0, 0, 0);">;<br /></span></div><br />DESC（ASC）也可以应用与多个column中：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> name, species, birth </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> pet </span><span style="color: rgb(0, 0, 255);">ORDER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> species, birth </span><span style="color: rgb(0, 0, 255);">DESC</span><span style="color: rgb(0, 0, 0);">;<br /></span></div>结果：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">--------+---------+------------+</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> name     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> species </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> birth      </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">--------+---------+------------+</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Chirpy   </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> bird    </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1998</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">09</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">11</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Whistler </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> bird    </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1997</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">12</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">09</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Claws    </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> cat     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1994</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">03</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Fluffy   </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> cat     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1993</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">02</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">04</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|//------------------</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Fang     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> dog     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1990</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">08</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">27</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|//  降序排列</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Bowser   </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> dog     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1989</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">08</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">31</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|//  </span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Buffy    </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> dog     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1989</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">05</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">13</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|//</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Puffball </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> hamster </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1999</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">03</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">30</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|//-------------------</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> Slim     </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> snake   </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1996</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">04</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">29</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">--------+---------+------------+</span><span style="color: rgb(0, 128, 128);"><br /></span></div><br />3、去掉返回结果中相同的记录（只返回一个）：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">DISTINCT</span><span style="color: rgb(0, 0, 0);"> amount </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> loan;</span></div><br />4、模糊查询：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> name </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> author </span><span style="color: rgb(0, 0, 255);">WHERE</span><span style="color: rgb(0, 0, 0);"> name </span><span style="color: rgb(128, 128, 128);">LIKE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">M%</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span></div>MySQL有两个通配符 % 和 _ 。其中 % 匹配 0或多个任意的字符， _ 匹配一个 任意字符<br /><br />5、获得某一行的最小值、最大值、平均值， 总和：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">MIN</span><span style="color: rgb(0, 0, 0);">(wt), </span><span style="color: rgb(255, 0, 255);">AVG</span><span style="color: rgb(0, 0, 0);">(wt), </span><span style="color: rgb(255, 0, 255);">MAX</span><span style="color: rgb(0, 0, 0);">(wt), </span><span style="color: rgb(255, 0, 255);">SUM</span><span style="color: rgb(0, 0, 0);">(wt) </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> person;<br /></span></div><br />6、时间运算：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> NOW(), CURTIME(), CURDATE();</span></div>运行结果：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">---------------------+-----------+------------+</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> NOW()                      </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> CURTIME() </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> CURDATE()  </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">---------------------+-----------+------------+</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2007</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">09</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">14</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(128, 0, 0); font-weight: bold;">42</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(128, 0, 0); font-weight: bold;">42</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2007</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">09</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">14</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 128, 128);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 128, 128);">+</span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">---------------------+-----------+------------+</span></div><br />7、把查询结果导出到文件：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> author<br />  </span><span style="color: rgb(0, 0, 255);">INTO</span><span style="color: rgb(0, 0, 0);"> OUTFILE </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">/tmp/author</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br />    FIELDS TERMINATED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br />    ENCLOSED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">"</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br />    LINES TERMINATED </span><span style="color: rgb(0, 0, 255);">BY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">\n</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span></div><br />当用 into dumpfile 代替 into outfile时，select语句返回的结果必须不能多于1条。into dumpfile写入文件的格式既没有column分隔符，也没有行分隔符，这在将BLOB写入文件时很有用。<br /><img src ="http://www.blogjava.net/JafeLee/aggbug/145044.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-14 10:45 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/14/145044.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (4) -- 存储数据</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/12/144458.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Wed, 12 Sep 2007 15:10:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/12/144458.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/144458.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/12/144458.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/144458.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/144458.html</trackback:ping><description><![CDATA[1、插入一条记录：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">INTO</span><span style="color: rgb(0, 0, 0);"> table_name (list </span><span style="color: rgb(0, 0, 255);">of</span><span style="color: rgb(0, 0, 0);"> columns) </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"> (list, </span><span style="color: rgb(0, 0, 255);">of</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">);<br /></span></div><br />其中INTO似乎可以省略掉~<br /><br />2、一次插入多条记录：看下面的例子<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> book (author, title, cond) </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"><br />    (</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">Maurice Sendak</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">In the Night Kitchen</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">mint</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br />    (</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">Caroll Spinney</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">How to Be a Grouch</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">poor</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br />    (</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">Dr. Seuss</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">Green Eggs and Ham</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">good</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span></div><br />3、auto_increment属性：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TEMPORARY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> demo (<br />  id </span><span style="color: rgb(0, 0, 0); font-weight: bold;">INT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">NOT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);"> AUTO_INCREMENT,<br />     </span><span style="color: rgb(0, 0, 255);">PRIMARY</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">KEY</span><span style="color: rgb(0, 0, 0);"> (id)<br />);<br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> demo () </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"> ();<br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> id </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> demo; # id </span><span style="color: rgb(0, 0, 255);">contains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> demo (id) </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> id </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> demo; # id </span><span style="color: rgb(0, 0, 255);">contains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">and</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> demo (id) </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 0); font-weight: bold;">4</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> id </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> demo; # id </span><span style="color: rgb(0, 0, 255);">contains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">and</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">4</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> demo (id) </span><span style="color: rgb(0, 0, 255);">VALUES</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> id </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> demo; # id </span><span style="color: rgb(0, 0, 255);">contains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0); font-weight: bold;">4</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 128, 128);"> and</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">5</span><span style="color: rgb(0, 0, 0);"><br /><br /></span></div>注意：一个表至多只能一个column是auto_increment的，而且该column必须是primary key的一个组成部分<br /><br /><br />4、插入当前日期和时间：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">INSERT some_table (some_column) VALUES (NOW());</span></div>运行<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">SELECT NOW();</span></div>可得到当前时间.<br /><br />5、从执行文件执行命令（有两种方法）：<br />（1）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">mysql </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">u <i>username</i> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">p <i>db_name</i> </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> <i>file_name.sql</i></span></div>敲入该命令之后，会有一个密码输入的提示符，输入密码之后，会执行file_name.sql中的命令并打印这些命令返回的结果。<br />（2）首先从命令行连接连接数据库，在mysql的提示符下敲入：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">\. <i>file_name.sql</i></span></div>其中 \.表示从文件中执行命令， 文件名既可以包含绝对路径也可以包含相对路径<br /><br />6、从另一个表复制数据：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">INSERT table_one (list, of, columns) SELECT <img src="http://www.blogjava.net/images/dot.gif" />;</span></div>注意：select 返回的column的类型和column的个数必须与insert的column和个数相兼容。<br /><br />7、从文件导入数据：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">LOAD DATA INFILE </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">some_file</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> INTO TABLE <i>table_name</i></span><i><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"></span></i><span style="color: rgb(0, 0, 0);"> (list, of, columns, <img src="http://www.blogjava.net/images/dot.gif" />);<br /></span></div>需注意的几点：<br /><ul><li>LOAD DATA INFILE 有很多参数，具体可参照MySQL reference</li><li>数据文件必须和mysql server在同一台机器上，如果是远程机器，则必须在INFILE之前添加参数local<br /></li><li>文件名最好加上绝对路径，如果没有指明完整路径，则mysql server会在它的数据目录下寻找该文件，如果有local参数，则会在你启动客服端的目录下找</li><li>在windows下，路径的标识符不能用反斜杠 \ ,只能使用正斜杠 / 或者使用转义字符 \\</li><li>使用小技巧：可以用show errors; 或show warnings;命令来查看返回的具体的错误信息。在将数据导入到table之前，可以先建立一个和要导入的表的结构一样temporary table(使用create table  ...like 命令，把数据导入到该临时表中看看结果是否正确</li></ul>8、存储精确的浮点数：使用DECIMAL类型，该类型在MySQL中是一字符串的形式存储的。<br /><img src ="http://www.blogjava.net/JafeLee/aggbug/144458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-12 23:10 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/12/144458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (3) -- Column 操作</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/11/144376.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Tue, 11 Sep 2007 14:52:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/11/144376.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/144376.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/11/144376.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/144376.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/144376.html</trackback:ping><description><![CDATA[1、显示一个table的所有columns：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">SHOW </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">FULL</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);"> COLUMNS </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> tbl_name </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">FROM db_name</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">LIKE 'pattern'</span><span style="color: rgb(255, 0, 0);">]</span></div><br />2、添加一个column：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">ALTER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> table_name </span><span style="color: rgb(0, 0, 255);">ADD</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">COLUMN</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">column_definition</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);"><br /></span></div>例如：<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">ALTER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> book </span><span style="color: rgb(0, 0, 255);">ADD</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">COLUMN</span><span style="color: rgb(0, 0, 0);"> ISBN </span><span style="color: rgb(0, 0, 0); font-weight: bold;">VARCHAR</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(128, 128, 128);">NOT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">;<br /></span></div>注意如果该column是NOT NULL的，则原来已经存在的rows对应的新的column将会被置为null，但是添加新的row时，该column就不能为空了。<br /><br />3、修改一个column： (alter可以修改多少内容?)<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">ALTER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> table_name CHANGE </span><span style="color: rgb(0, 0, 255);">COLUMN</span><span style="color: rgb(0, 0, 0);"> column_name </span><span style="color: rgb(255, 0, 0);">[</span><span style="color: rgb(255, 0, 0);">column_definition</span><span style="color: rgb(255, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">;<br /></span></div>例如：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">ALTER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> book CHANGE </span><span style="color: rgb(0, 0, 255);">COLUMN</span><span style="color: rgb(0, 0, 0);"> ISBN isbn </span><span style="color: rgb(0, 0, 0); font-weight: bold;">VARCHAR</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(128, 128, 128);">NOT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">;</span></div><br />4、删除一个column：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">ALTER</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> table_name </span><span style="color: rgb(0, 0, 255);">DROP</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">COLUMN</span><span style="color: rgb(0, 0, 0);"> column_name;<br /></span></div><br /><img src ="http://www.blogjava.net/JafeLee/aggbug/144376.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-11 22:52 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/11/144376.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (2) -- 管理表</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/11/144266.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Tue, 11 Sep 2007 07:15:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/11/144266.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/144266.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/11/144266.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/144266.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/144266.html</trackback:ping><description><![CDATA[1、列出某一个数据库中的所有表的名字：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">SHOW TABLES;<br />SHOW TABLES </span><span style="color: rgb(128, 128, 128);">IN</span><span style="color: rgb(0, 0, 0);"> database_name;<br />SHOW TABLES </span><span style="color: rgb(128, 128, 128);">LIKE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">word%</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br />SHOW TABLES </span><span style="color: rgb(128, 128, 128);">IN</span><span style="color: rgb(0, 0, 0);"> database_name </span><span style="color: rgb(128, 128, 128);">LIKE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">word%</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /><br /></span></div>注意要使用上面第一和第三个命令必须先指定默认数据库(使用USE 命令）<br /><br />2、创建一个简单的表：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> account<br />(account_number </span><span style="color: rgb(0, 0, 0); font-weight: bold;">char</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(128, 128, 128);">not</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">,<br />branch_name </span><span style="color: rgb(0, 0, 0); font-weight: bold;">char</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(128, 128, 128);">not</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">,<br />balance numeric(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0); font-weight: bold;">3</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(128, 128, 128);">not</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 0, 255);">primary</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">key</span><span style="color: rgb(0, 0, 0);"> (account_number));<br /></span></div>实际中创建一个表远比这个复杂，具体可以查看MySQL相关文档。<br /><br />3、重命名一个表：和重命名一个数据库相比，重命名一个表相当简单、直接<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">RENAME </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> old_name </span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> new_name;</span></div><br />4、删除一个表：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">DROP</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> table_name;</span></div><br />5、复制一个表：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> new_table </span><span style="color: rgb(128, 128, 128);">LIKE</span><span style="color: rgb(0, 0, 0);"> old_table;<br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> new_table </span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> old_table;<br /></span></div><br />也可以从一个数据库把表copy到另一个数据库：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> db1.</span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">LIKE</span><span style="color: rgb(0, 0, 0);"> db2.</span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 0, 255);">INSERT</span><span style="color: rgb(0, 0, 0);"> db1.</span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> db2.</span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);">;<br /><br /></span></div>注意，在这里LIKE并不是通配符的标志<br /><img src ="http://www.blogjava.net/JafeLee/aggbug/144266.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-11 15:15 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/11/144266.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命令 (1) -- 管理数据库</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/11/144252.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Tue, 11 Sep 2007 06:38:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/11/144252.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/144252.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/11/144252.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/144252.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/144252.html</trackback:ping><description><![CDATA[1、命令行连接MySQL数据库：<br />    <strong class="userinput"><code>mysql -h <font color="#ff0000"><em class="replaceable"><code>host</code></em></font> -u <font color="#ff0000"><em class="replaceable"><code>user</code></em></font> -p</code></strong><br />    Enter password: <strong class="userinput"><code>********<br />其中 host是MySQL主机的ip（本机的话也可以用localhost)，user是你的用户名<br /></code></strong><pre class="programlisting"></pre>2、列出服务器上所有数据库名称：<span class="docEmphStrong"><b><font color="#0000ff"><a name="iddle1197"></a><a name="iddle1738"></a>SHOW DATABASES</font>; </b><br /><br />3、模糊比配列出符合条件的数据库名称：</span><span class="docEmphStrong"><b><font color="#0000ff">SHOW DATABASES LIKE 'my%';<br /><br /></font></b><font color="#0000ff"><font color="#000000">4、设置默认数据库：</font></font></span><font color="#0000ff"><span class="docEmphStrong"><a name="iddle1203"></a>USE <font color="#ff0000"><i>databasename</i></font>; <font color="#000000"> 例如：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> bank.account;</span></div>等同于：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">USE</span><span style="color: rgb(0, 0, 0);"> bank;<br /></span><span style="color: rgb(0, 0, 255);">SELECT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">FROM</span><span style="color: rgb(0, 0, 0);"> account;</span></div>也可以在连接时指定默认数据库：<br /></font></span></font>       <strong class="userinput"><code>mysql -h <font color="#ff0000"><em class="replaceable"><code>host</code></em></font> -u <font color="#ff0000"><em class="replaceable"><code>user</code></em></font> -p <i>databasename<br /><br /></i></code></strong><font color="#0000ff"><span class="docEmphStrong"><font color="#000000">5、创建数据库：CREATE DATABASE <i><font color="#ff0000">databasename</font></i>;<br />    删除数据库：DROP DATABASE <i><font color="#ff0000">databasename</font></i>;<br /><br />6、重命名一个数据库：没有直接的命令，可以参照下面的例子（似乎很少碰到这种情况的）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);"> Temporarily disable permissions</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(0, 0, 255);">CREATE</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">DATABASE</span><span style="color: rgb(0, 0, 0);"> library;<br />RENAME </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> books.book </span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> library.book;<br />RENAME </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> books.borrower </span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> library.borrower;<br />RENAME </span><span style="color: rgb(0, 0, 255);">TABLE</span><span style="color: rgb(0, 0, 0);"> books.loan </span><span style="color: rgb(0, 0, 255);">TO</span><span style="color: rgb(0, 0, 0);"> library.loan;<br /></span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);"> Migrate permissions</span><span style="color: rgb(0, 128, 128);"><br />--</span><span style="color: rgb(0, 128, 128);"> Re-enable permissions</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);"><br /></span></div><br /></font></span></font><span class="docEmphStrong"></span><img src ="http://www.blogjava.net/JafeLee/aggbug/144252.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-11 14:38 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/11/144252.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL Table 的一些术语</title><link>http://www.blogjava.net/JafeLee/archive/2007/09/11/144178.html</link><dc:creator>Jafe</dc:creator><author>Jafe</author><pubDate>Tue, 11 Sep 2007 02:36:00 GMT</pubDate><guid>http://www.blogjava.net/JafeLee/archive/2007/09/11/144178.html</guid><wfw:comment>http://www.blogjava.net/JafeLee/comments/144178.html</wfw:comment><comments>http://www.blogjava.net/JafeLee/archive/2007/09/11/144178.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JafeLee/comments/commentRss/144178.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JafeLee/services/trackbacks/144178.html</trackback:ping><description><![CDATA[
		<img src="http://www.blogjava.net/images/blogjava_net/jafelee/mysqltable.jpg" alt="mysqltable.jpg" align="middle" border="0" height="384" width="702" />
		<br />
<img src ="http://www.blogjava.net/JafeLee/aggbug/144178.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JafeLee/" target="_blank">Jafe</a> 2007-09-11 10:36 <a href="http://www.blogjava.net/JafeLee/archive/2007/09/11/144178.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>