Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

mysql 语法问题 求帮助 谢谢

CREATE TABLE douyin_webcast(  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,   room_id INT(50) NOT NULL DEFAULT 0,   user_id VARCHAR(100) NOT NULL DEFAULT '',   timetamp BIGINT(20) NOT NULL DEFAULT 0,   action CHAR(20) NOT NULL DEFAULT '',   extension VARCHAR(600) NOT NULL DEFAULT 0,   PRIMARY KEY (`Id`), )DEFAULT CHARSET=UTF8 TYPE=INNODB;

报错如下

CREATE TABLE douyin_webcast(  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,   room_id INT(50) NOT NULL DEFAULT 0,   user_id VARCHAR(100) NOT NULL DEFAULT '',   timetamp BIGINT(20) NOT NULL DEFAULT 0,   action CHAR(20) NOT NULL DEFAULT '',   extension VARCHAR(600) NOT NULL DEFAULT 0,   PRIMARY KEY (`Id`), )DEFAULT CHARSET=UTF8 TYPE=INNODB;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')DEFAULT CHARSET=UTF8 TYPE=INNODB' at line 1

这个 括号后面的 DEFAULT 如何写的?
有人知道吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

试下这样?

CREATE TABLE douyin_webcast (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    room_id INT(50) NOT NULL DEFAULT 0,
    user_id VARCHAR(100) NOT NULL DEFAULT '',
    timetamp BIGINT(20) NOT NULL DEFAULT 0,
    action CHAR(20) NOT NULL DEFAULT '',
    extension VARCHAR(600) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`)
)  DEFAULT CHARSET=UTF8 ENGINE=INNODB;

type=InnoDB在5.0以前使用,5.0后使用ENGINE=INNODB


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...