一表单 原来是myisam引擎 多主键 有一个自动增长字段 转换成innodb会报错 ,网上查出innodb联合主键 自动增长字段需要在主键顺序里最前面 否则会报错. 现在我不确定如果把seq 自动增长字段顺序调到最前面是否会有所影响.谢谢! 如图:
by caidanfeng - MySQL - 2014-06-04 16:38:46 阅读(1574) 回复(0)
我的student表中设置了唯一主键:GUGID字段 Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | GUGID | int(8) | | PRI | NULL | auto_increment 我想取消掉主键,请大家帮忙,该怎么取消啊, 我用 alter table student drop primary key (GUGID); 或 alter table student drop primary key; 报错:Incorrec...
在一个表上有2个联合索引y(a,b,c),x(a,c) 我查询的时候 select * from table where a=1201 order by c desc limit 20 的时候用explain查看,发现mysql用的是y索引 这样我在extra里看到有filesort,而不是我想要的x索引,这个怎么办?怎么才能用到我的x索引 | tb_goods | 0 | PRIMARY | 1 | iid | A | 2350642 | NULL | NULL | | BTREE | NULL | | tb_goods | ...
今天在做一个统计报表的时候用到了order by desc排序,结果发现它不能和 union一起使用 Error Code : 1054 Unknown column 't2.count_vod' in 'order clause' 原句: select 'a week upload',count(*) from update_table where date_format(time,'%Y%m%d') = date_format(DATE_ADD(now(),INTERVAL -7 DAY),'%Y%m%d') union select 'a week upload title',t1.title,t2.user_count from update_table as t1 ,update_user as t2...
偶然看到了“Fotolog: Scaling the World's Largest Photo Blogging Community”,才发现很多数据库的优化其实道理都很简单,至高境界是当你面对问题时,是否真正做出了自己的思考,而不仅仅只是经验主义的惯性使然:
本文案例背景介绍:一个图片网站,每张图片都有很...