mysql 错误集

来源:互联网 发布:淘宝卖家邮费怎么便宜 编辑:程序博客网 时间:2024/05/29 06:58

1.

create table t(     id int auto_increment,      #it must be define as a key      name varchar(20),     age int);<span style="font-size:18px;"></span>

Error:Incorrect table definition,there can be only one auto column and it must be define as a key。把id定义为primary key 或者其他key 就可以了


2.select count(*), age from t where age>20 group by school  和 select count(*) ,age from t group by school having age>20的差别

          第一个是对所有age>20的查询结果按字段school分组,第二个是先按字段school分组,然后把每一组中age都大于20的组返回出来


3.insert tablename(column1, column2) select column1, column2 from t;

         讲一个表中的某个字段的值复制到另一个表中

0 0
原创粉丝点击