??xml version="1.0" encoding="utf-8" standalone="yes"?>污污网站在线观看,男女视频一区二区,色综合天天在线http://www.aygfsteel.com/jefflee/category/32311.htmlzh-cnSat, 21 Jun 2008 18:36:08 GMTSat, 21 Jun 2008 18:36:08 GMT60MySQL 聚集函数 (aggregate function)http://www.aygfsteel.com/jefflee/archive/2008/06/20/209463.htmlJeff LeeJeff LeeFri, 20 Jun 2008 07:21:00 GMThttp://www.aygfsteel.com/jefflee/archive/2008/06/20/209463.htmlhttp://www.aygfsteel.com/jefflee/comments/209463.htmlhttp://www.aygfsteel.com/jefflee/archive/2008/06/20/209463.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/209463.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/209463.html

Function

Description

AVG()

Returns a column's average value

COUNT()

Returns the number of rows in a column

MAX()

Returns a column's highest value

MIN()

Returns a column's lowest value

SUM()

Returns the sum of a column's values

聚集函数q回的是某一个单独的|而不是象有些sql语句一栯回多行的记录?br />
2、接下来我们用一?a href="/Files/jefflee/bank.zip">bank来实验学习MySQL?br />Q?Q求出所有银行贷出去的款Ҏ额Q?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%;">SELECT sum(amount) as sum FROM loan;Q?Q求出最大一W贷ƾ业务的金额Q?br />
SELECT max(amount) AS max_amount FROM loan;




Jeff Lee 2008-06-20 15:21 发表评论
]]>
MySQL命o (9) -- 备䆾和恢?/title><link>http://www.aygfsteel.com/jefflee/archive/2007/09/21/208119.html</link><dc:creator>Jeff Lee</dc:creator><author>Jeff Lee</author><pubDate>Fri, 21 Sep 2007 13:47:00 GMT</pubDate><guid>http://www.aygfsteel.com/jefflee/archive/2007/09/21/208119.html</guid><wfw:comment>http://www.aygfsteel.com/jefflee/comments/208119.html</wfw:comment><comments>http://www.aygfsteel.com/jefflee/archive/2007/09/21/208119.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jefflee/comments/commentRss/208119.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jefflee/services/trackbacks/208119.html</trackback:ping><description><![CDATA[1、备份整个数据库Q估计也是最土的Ҏ了)<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 > filename.sql</span></div><ul><li>如果没有指定 host和port参数Q则客户端会q向localhost的mysql server?/li><li>如果要备份多个数据库Q则可添加参?--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 < filename.sql</span></div><br />Q未完待l,在研究中~)<br /><img src="/JafeLee/aggbug/146817.html" width="1" height="1" /><br /><br /><div align="right"><a style="text-decoration: none;" href="/JafeLee/" target="_blank">Jafe</a> 2007-09-21 21:47 <a href="/JafeLee/archive/2007/09/21/146817.html#Feedback" target="_blank" style="text-decoration: none;">发表评论</a></div><img src ="http://www.aygfsteel.com/jefflee/aggbug/208119.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jefflee/" target="_blank">Jeff Lee</a> 2007-09-21 21:47 <a href="http://www.aygfsteel.com/jefflee/archive/2007/09/21/208119.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命o (8) -- 客服端命令行http://www.aygfsteel.com/jefflee/archive/2007/09/21/208120.htmlJeff LeeJeff LeeFri, 21 Sep 2007 13:46:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/21/208120.htmlhttp://www.aygfsteel.com/jefflee/comments/208120.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/21/208120.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208120.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208120.html
mysql [-h host] [-u user_name] [-p] [db_name]
注意Q?br />
  •  db_name 表示默认数据库,相当与连接成功后的use db_name?/li>
  • -p 表示密码选项Q当有该选项是,mysql会弹出密码输入对话框Q否则mysql以匿名形式向服务器发送登录请?/li>
  • 也可以在-p后直接加上密码,mysql直接向服务器发送登录请求,注意密码?p之间不能有空?/li>
2、批量处理命令:
echo 'SELECT 1 + 1' | mysql -u some_user -p
mysql命o行也支持重定向:
mysql -user -< input_file > output_file

3、从执行文g执行命oQ有两种ҎQ:
Q?Q?br />
mysql -username -db_name < file_name.sql
敲入该命令之后,会有一个密码输入的提示W,输入密码之后Q会执行file_name.sql中的命oq打印这些命令返回的l果?br />Q?Q首先从命o行连接连接数据库Q在mysql的提C符下敲入:
\. file_name.sql
其中 \.表示从文件中执行命oQ?文g名既可以包含l对路径也可以包含相对\?br />
4、如果要清除当前行的命o在命令后d \cQ例如:
DROP DATABASE foo;\c
(未完待箋Q因不是很重要,暂不研究Q?br />

Jafe 2007-09-21 21:46 发表评论


Jeff Lee 2007-09-21 21:46 发表评论
]]>
MySQL命o (7) -- 用户理http://www.aygfsteel.com/jefflee/archive/2007/09/19/208121.htmlJeff LeeJeff LeeWed, 19 Sep 2007 11:19:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/19/208121.htmlhttp://www.aygfsteel.com/jefflee/comments/208121.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/19/208121.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208121.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208121.htmlCREATE USER user@host IDENTIFIED BY 'password';例如Q?br />
CREATE USER test@localhost IDENTIFIED BY 'localhost';
以及
CREATE USER test@192.76.23.10 IDENTIFIED BY 'remote';
上面两个例子创徏的用户名名字虽然相同Q但是两个的差别实相当大的Q例如,W一个test只能从本机登录,W二个test只能从ip?192.76.23.10的机器登录。MySQL服务器通过两者的password来区别他们?br />
2、删除一个用P
DROP USER user@host;
如果没指明hostQ则默认?drop user user@"%"Q你必须在此前创建相应的用户Q否则会引发错误?br />
3、重命名一个用P
RENAME USER old_user@host TO new_user@host;
实际上该命o既可以修改usernameQ也可以修改host~

4、用通配W?% :
CREATE USER 'test'@'192.76.23.%';

CREATE USER 'test'@'%';

5、获取有关用户和数据库关pȝ信息Q?br />
SELECT Db FROM db 
WHERE User = 'user' AND Host = 'host';


SELECT Table_name FROM tables_priv
WHERE User = 'user'
AND Host = 'host' AND Db = 'db';
注意Q表 db在数据库mysql中,该数据库q包括很多其他信息?br />
6、设|密码:
讄自己的密码:
SET PASSWORD = PASSWORD('password');

讄别h的密码(必须有管理权限)Q?br />
SET PASSWORD FOR user@host = PASSWORD('password');

7、赋予用户一定权限:
GRANT privileges ON db.table
TO user@host
IDENTIFIED 
BY 'password';
收回用户权限Q?br />
REVOKE privileges ON db.table
FROM user@host
IDENTIFIED 
BY 'password';



Jafe 2007-09-19 19:19 发表评论


Jeff Lee 2007-09-19 19:19 发表评论
]]>
MySQL命o (6) -- 修改数据http://www.aygfsteel.com/jefflee/archive/2007/09/18/208122.htmlJeff LeeJeff LeeTue, 18 Sep 2007 10:31:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/18/208122.htmlhttp://www.aygfsteel.com/jefflee/comments/208122.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/18/208122.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208122.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208122.htmlUPDATE book SET cond = 'mint';一般不要这么用Q因会将一个column的所有行的cond设ؓ 'mint'?br />
UPDATE book SET author = "Theodor Geisel" WHERE author = "Dr. Seuss";

2、在update中用公式:
UPDATE loan
SET date_lent = DATE_ADD(date_lent, INTERVAL 1 YEAR)
WHERE date_lent = '2005-01-01';

3、删除行Q?br />
DELETE FROM book WHERE cond = 'poor';
如果省略 where 语句Q则会删除掉所有列

4、从多个表中删除Q?br />
DELETE book, loan    # tables to delete from
FROM book, loan    # tables to use in WHERE clause
WHERE book.book_id = loan.book_id
AND book.cond = 'poor';



Jafe 2007-09-18 18:31 发表评论


Jeff Lee 2007-09-18 18:31 发表评论
]]>
MySQL命o (5) -- 获取数据http://www.aygfsteel.com/jefflee/archive/2007/09/14/208123.htmlJeff LeeJeff LeeFri, 14 Sep 2007 02:45:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/14/208123.htmlhttp://www.aygfsteel.com/jefflee/comments/208123.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/14/208123.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208123.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208123.htmlQ?Q?br />
SELECT author FROM book LIMIT 2;
该命令将q回前两行记?br />Q?Q?br />
SELECT author FROM book LIMIT 12;
该命令返回两条记录,但是该记录是从第二条记录开始算P注意,行数计数的vҎ?而不?开始的Q这跟Java中的数组很象)

2、排序返回的l果Q(order by)
SELECT name, birth FROM pet ORDER BY birth;

q回的序列以升序Q默认)形式排列Q如果想降序排列Q则需要这P
SELECT name, birth FROM pet ORDER BY birth DESC;

你也可以昑ּ指明按升序方式排列:
SELECT name, birth FROM pet ORDER BY birth ASC;

DESCQASCQ也可以应用与多个column中:
SELECT name, species, birth FROM pet ORDER BY species, birth DESC;
l果Q?br />
+----------+---------+------------+
| name     | species | birth      |
+----------+---------+------------+
| Chirpy   | bird    | 1998-09-11 |
| Whistler | bird    | 1997-12-09 |
| Claws    | cat     | 1994-03-17 |
| Fluffy   | cat     | 1993-02-04 |//------------------
| Fang     | dog     | 1990-08-27 |//  降序排列
| Bowser   | dog     | 1989-08-31 |// 
| Buffy    | dog     | 1989-05-13 |//
| Puffball | hamster | 1999-03-30 |//-------------------
| Slim     | snake   | 1996-04-29 |
+----------+---------+------------+

3、去掉返回结果中相同的记录(只返回一个)Q?br />
SELECT DISTINCT amount FROM loan;

4、模p查询:
SELECT name FROM author WHERE name LIKE 'M%';
MySQL有两个通配W?% ?_ 。其?% 匚w 0或多个Q意的字符Q?_ 匚w一?L字符

5、获得某一行的最倹{最大倹{^均| dQ?br />
SELECT MIN(wt), AVG(wt), MAX(wt), SUM(wt) FROM person;

6、时间运:
 SELECT NOW(), CURTIME(), CURDATE();
q行l果Q?br />
+-----------------------+-----------+------------+
| NOW()                      | CURTIME() | CURDATE()  |
+-----------------------+-----------+------------+
| 2007-09-14 10:42:20 | 10:42:20| 2007-09-14|
+-----------------------+-----------+------------+

7、把查询l果导出到文Ӟ
SELECT * FROM author
  
INTO OUTFILE '/tmp/author'
    FIELDS TERMINATED 
BY ','
    ENCLOSED 
BY '"'
    LINES TERMINATED 
BY '\n';

当用 into dumpfile 代替 into outfileӞselect语句q回的结果必M能多?条。into dumpfile写入文g的格式既没有column分隔W,也没有行分隔W,q在BLOB写入文g时很有用?br />

Jafe 2007-09-14 10:45 发表评论


Jeff Lee 2007-09-14 10:45 发表评论
]]>
MySQL命o (4) -- 存储数据http://www.aygfsteel.com/jefflee/archive/2007/09/12/208124.htmlJeff LeeJeff LeeWed, 12 Sep 2007 15:10:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/12/208124.htmlhttp://www.aygfsteel.com/jefflee/comments/208124.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/12/208124.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208124.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208124.html
INSERTINTO table_name (list of columns) VALUES (list, ofvalues);

其中INTOg可以省略掉~

2、一ơ插入多条记录:看下面的例子

INSERT book (author, title, cond) VALUES
    (
'Maurice Sendak','In the Night Kitchen','mint'),
    (
'Caroll Spinney','How to Be a Grouch','poor'),
    (
'Dr. Seuss''Green Eggs and Ham''good');

3、auto_increment属性:
CREATE TEMPORARY TABLE demo (
  id 
INT NOT NULL AUTO_INCREMENT,
     
PRIMARY KEY (id)
);
INSERT demo () VALUES ();
SELECT id FROM demo; # id contains 1
INSERT demo (id) VALUES (NULL);
SELECT id FROM demo; # id contains 1 and 2
INSERT demo (id) VALUES (4);
SELECT id FROM demo; # id contains 12 and 4
INSERT demo (id) VALUES (NULL);
SELECT id FROM demo; # id contains 124 and 5

注意Q一个表臛_只能一个column是auto_increment的,而且该column必须是primary key的一个组成部?br />

4、插入当前日期和旉Q?br />
INSERT some_table (some_column) VALUES (NOW());
q行
SELECT NOW();
可得到当前时?

5、从执行文g执行命oQ有两种ҎQ:
Q?Q?br />
mysql -username -db_name < file_name.sql
敲入该命令之后,会有一个密码输入的提示W,输入密码之后Q会执行file_name.sql中的命oq打印这些命令返回的l果?br />Q?Q首先从命o行连接连接数据库Q在mysql的提C符下敲入:
\. file_name.sql
其中 \.表示从文件中执行命oQ?文g名既可以包含l对路径也可以包含相对\?br />
6、从另一个表复制数据Q?br />
INSERT table_one (list, of, columns) SELECT ;
注意Qselect q回的column的类型和column的个数必Minsert的column和个数相兼容?br />
7、从文g导入数据Q?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%;">LOAD DATA INFILE 'some_file' INTO TABLE table_name (list, of, columns, );
需注意的几点:
  • LOAD DATA INFILE 有很多参敎ͼ具体可参照MySQL reference
  • 数据文g必须和mysql server在同一台机器上Q如果是q程机器Q则必须在INFILE之前d参数local
  • 文g名最好加上绝对\径,如果没有指明完整路径Q则mysql server会在它的数据目录下寻找该文gQ如果有local参数Q则会在你启动客服端的目录下?/li>
  • 在windows下,路径的标识符不能用反斜杠 \ ,只能使用正斜?/ 或者用{义字W?\\
  • 使用技巧:可以用show errors; 或show warnings;命o来查看返回的具体的错误信息。在数据导入到table之前Q可以先建立一个和要导入的表的l构一样temporary table(使用create table  ...like 命oQ把数据导入到该临时表中看看l果是否正确
8、存储精的点敎ͼ使用DECIMALcdQ该cd在MySQL中是一字符串的形式存储的?br />

Jafe 2007-09-12 23:10 发表评论


Jeff Lee 2007-09-12 23:10 发表评论
]]>
MySQL命o (3) -- Column 操作http://www.aygfsteel.com/jefflee/archive/2007/09/11/208125.htmlJeff LeeJeff LeeTue, 11 Sep 2007 14:52:00 GMThttp://www.aygfsteel.com/jefflee/archive/2007/09/11/208125.htmlhttp://www.aygfsteel.com/jefflee/comments/208125.htmlhttp://www.aygfsteel.com/jefflee/archive/2007/09/11/208125.html#Feedback0http://www.aygfsteel.com/jefflee/comments/commentRss/208125.htmlhttp://www.aygfsteel.com/jefflee/services/trackbacks/208125.html
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']

2、添加一个columnQ?br />
ALTER TABLE table_name ADD COLUMN [column_definition];
例如Q?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%;">ALTER TABLE book ADD COLUMN ISBN VARCHAR(10NOT NULL;
注意如果该column是NOT NULL的,则原来已l存在的rows对应的新的column会被置为nullQ但是添加新的rowӞ该column׃能ؓIZ?br />
3、修改一个columnQ?(alter可以修改多少内容?)
ALTER TABLE table_name CHANGE COLUMN column_name [column_definition];
例如Q?br />
ALTER TABLE book CHANGE COLUMN ISBN isbn VARCHAR(10NOT NULL;

4、删除一个columnQ?br />
ALTER TABLE table_name DROP COLUMN column_name;



Jafe 2007-09-11 22:52 发表评论


Jeff Lee 2007-09-11 22:52 发表评论
]]>
MySQL命o (2) -- 理?/title><link>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208126.html</link><dc:creator>Jeff Lee</dc:creator><author>Jeff Lee</author><pubDate>Tue, 11 Sep 2007 07:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208126.html</guid><wfw:comment>http://www.aygfsteel.com/jefflee/comments/208126.html</wfw:comment><comments>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208126.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jefflee/comments/commentRss/208126.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jefflee/services/trackbacks/208126.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>注意要用上面第一和第三个命o必须先指定默认数据库(使用USE 命oQ?br /><br />2、创Z个简单的表:<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>实际中创Z个表q比q个复杂Q具体可以查看MySQL相关文?br /><br />3、重命名一个表Q和重命名一个数据库相比Q重命名一个表相当单、直?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、删除一个表Q?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、复制一个表Q?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到另一个数据库Q?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>注意Q在q里LIKEq不是通配W的标志<br /><img src="/JafeLee/aggbug/144266.html" width="1" height="1" /><br /><br /><div align="right"><a style="text-decoration: none;" href="/JafeLee/" target="_blank">Jafe</a> 2007-09-11 15:15 <a href="/JafeLee/archive/2007/09/11/144266.html#Feedback" target="_blank" style="text-decoration: none;">发表评论</a></div><img src ="http://www.aygfsteel.com/jefflee/aggbug/208126.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jefflee/" target="_blank">Jeff Lee</a> 2007-09-11 15:15 <a href="http://www.aygfsteel.com/jefflee/archive/2007/09/11/208126.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL命o (1) -- 理数据?/title><link>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208127.html</link><dc:creator>Jeff Lee</dc:creator><author>Jeff Lee</author><pubDate>Tue, 11 Sep 2007 06:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208127.html</guid><wfw:comment>http://www.aygfsteel.com/jefflee/comments/208127.html</wfw:comment><comments>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208127.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jefflee/comments/commentRss/208127.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jefflee/services/trackbacks/208127.html</trackback:ping><description><![CDATA[1、命令行q接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是MySQLL的ipQ本机的话也可以用localhost)Quser是你的用户名<br /></code></strong><pre class="programlisting"></pre>2、列出服务器上所有数据库名称Q?span class="docEmphStrong"><b><font color="#0000ff"><a name="iddle1197"></a><a name="iddle1738"></a>SHOW DATABASES</font>; </b><br /><br />3、模p比配列出符合条件的数据库名Uͼ</span><span id="wmqeeuq" class="docEmphStrong"><b><font color="#0000ff">SHOW DATABASES LIKE 'my%';<br /><br /></font></b><font color="#0000ff"><font color="#000000">4、设|默认数据库Q?/font></font></span><font color="#0000ff"><span id="wmqeeuq" class="docEmphStrong"><a name="iddle1203"></a>USE <font color="#ff0000"><i>databasename</i></font>; <font color="#000000"> 例如Q?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>也可以在q接时指定默认数据库Q?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 id="wmqeeuq" class="docEmphStrong"><font color="#000000">5、创建数据库QCREATE DATABASE <i><font color="#ff0000">databasename</font></i>;<br />    删除数据库:DROP DATABASE <i><font color="#ff0000">databasename</font></i>;<br /><br />6、重命名一个数据库Q没有直接的命oQ可以参照下面的例子Q似乎很碰到这U情늚Q?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 id="wmqeeuq" class="docEmphStrong"></span><img src="/JafeLee/aggbug/144252.html" width="1" height="1" /><br /><br /><div align="right"><a style="text-decoration: none;" href="/JafeLee/" target="_blank">Jafe</a> 2007-09-11 14:38 <a href="/JafeLee/archive/2007/09/11/144252.html#Feedback" target="_blank" style="text-decoration: none;">发表评论</a></div><img src ="http://www.aygfsteel.com/jefflee/aggbug/208127.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jefflee/" target="_blank">Jeff Lee</a> 2007-09-11 14:38 <a href="http://www.aygfsteel.com/jefflee/archive/2007/09/11/208127.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL Table 的一些术?/title><link>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208128.html</link><dc:creator>Jeff Lee</dc:creator><author>Jeff Lee</author><pubDate>Tue, 11 Sep 2007 02:36:00 GMT</pubDate><guid>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208128.html</guid><wfw:comment>http://www.aygfsteel.com/jefflee/comments/208128.html</wfw:comment><comments>http://www.aygfsteel.com/jefflee/archive/2007/09/11/208128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jefflee/comments/commentRss/208128.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jefflee/services/trackbacks/208128.html</trackback:ping><description><![CDATA[ <img src="http://www.aygfsteel.com/images/blogjava_net/jafelee/mysqltable.jpg" alt="mysqltable.jpg" align="middle" border="0" width="702" height="384" /> <br /> <img src="/JafeLee/aggbug/144178.html" width="1" height="1" /> <br /> <br /> <div align="right"> <a style="text-decoration: none;" href="/JafeLee/" target="_blank">Jafe</a> 2007-09-11 10:36 <a href="/JafeLee/archive/2007/09/11/144178.html#Feedback" target="_blank" style="text-decoration: none;">发表评论</a></div> <img src ="http://www.aygfsteel.com/jefflee/aggbug/208128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jefflee/" target="_blank">Jeff Lee</a> 2007-09-11 10:36 <a href="http://www.aygfsteel.com/jefflee/archive/2007/09/11/208128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">߰</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͭ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˫</a>| <a href="http://" target="_blank">²</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">Ϻӿ</a>| <a href="http://" target="_blank">ݶ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">޼</a>| <a href="http://" target="_blank">߷</a>| <a href="http://" target="_blank">Ž</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">ٹ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͻ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϲ</a>| <a href="http://" target="_blank">ɫ</a>| <a href="http://" target="_blank">ī</a>| <a href="http://" target="_blank">˫</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>