日期:2014-05-16  浏览次数:20758 次

菜鸟询问建表问题
本人刚学mysql没多久,在建表的时候,参照:《mysql必知必会》里面的建表模式如下建表:
mysql> create table customers(cust_id int not null auto_increment,primary key(cust_id))engine=innodb;
这样建表是成功的,但是我想把建表里面的列的数据类型位置调换一下就不行了:
mysql> create table customers(cust_id not null int auto_inrement,primary key(cust_id))engine=innodb;

仅仅是把 int和not null这两个数据类型调换了一下位置就不行了,为什么? 是不是建表有这个固定的模式,违反了就不行?

------解决方案--------------------
语法要求,先定义类型
CREATE TABLE customers(cust_id INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(cust_id))ENGINE=INNODB;
------解决方案--------------------
这个是建表的固定语法