
深入浅出 - Mysql 数据库开发、优化与管理维护
Robin2Wu
这个作者很懒,什么都没留下…
展开
-
Mysql timestamp与datetime区别
创建表[code="sql"]create table t8 ( `id1` timestamp NOT NULL default CURRENT_TIMESTAMP, `id2` datetime default NULL);[/code]查看表结构[code="sql"]desc t8;[/code][img]http://www.iteye.c...2009-01-01 09:07:19 · 123 阅读 · 0 评论 -
Mysql char数据类型尾部去空格
[b]char数据类型尾部去空格[/b][code="sql"]create table db_name(name char(10)) engine=myisam;insert into db_namevalues("abcde"), ("abcde "), (" abcde"), (" abcde ");mysql> select name, length...2009-01-10 22:07:58 · 708 阅读 · 0 评论 -
Mysql InnoDB表外键约束
[code="sql"]CREATE TABLE `country` ( `country_id` smallint(5) unsigned NOT NULL auto_increment, `country` varchar(50) NOT NULL, `last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on...2009-01-10 22:52:30 · 298 阅读 · 0 评论 -
Mysql text 空洞问题
Mysql text 空洞问题[code="sql"]create table t (id varchar(100), context text);insert into t values(1, repeat('haha', 100));insert into t values(2, repeat('haha', 100));insert into t values(3, ...2009-01-11 20:09:42 · 234 阅读 · 0 评论 -
Mysql Group by 与 With Rollup
[code="jave"]create table sales ( `year` int not null, `country` varchar(20) not null, `product` varchar(32) not null, `profit` int);insert into sales values(2004, "china", "tnt1",...2009-01-15 12:33:08 · 126 阅读 · 0 评论 -
Mysql 优化 SQL
查看SQL执行频率[code="jave"]show status like "Com_%";[/code]记录慢语句[code="jave"]vi /etc/mysql/my.cnflog_slow_queries = /var/log/mysql/mysql-slow.log[/code]查看没有使用索引[code="jave"]expla...2009-01-15 12:51:54 · 114 阅读 · 0 评论