/******************
CREATE TABLE consumerinfo(
cid varchar(20) not null,
cname varchar(50) not null,
clinkname varchar(50) not null,
caddredd varchar(50) not null,
ctel varchar(20) not null,
cemail varchar(50) default '暂无',
cremart varchar(100) default '暂无',
primary key (cid)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
******************/
前两个都可以mysql>create table test_a(name varchar(10) default 'abc')
Query OK, 0 rows affected (0.01 sec)
mysql>create table test_b(name varchar(10) default "abc")
Query OK, 0 rows affected (0.00 sec)
mysql>create table test_c(name varchar(10) default abc)
ERROR 1064 (42000): You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'abc)' at line 1
mysql>
ALTER TABLE bookInfoADD CONSTRAINT FK_booktypeId
FOREIGN KEY(booktypeId) REFERENCES bookType(booktypeId)
ALTER TABLE bookInfo
ALTER bigImag SET DEFAULT 'nullBig.png'
分步执行可以成功
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)