这可能会以反对票告终,但由于森林,我看不到树木:
运行此 sql 查询:
CREATE TABLE `fontFamilies` (
`id` INTEGER NULL AUTO_INCREMENT DEFAULT NULL,
`name` VARCHAR NOT NULL DEFAULT 'NULL',
`designer` INTEGER NULL,
`firstLaunch` TIMESTAMP NULL DEFAULT NULL,
`lastUpdate` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
我在 http://sqlfiddle.com/ 中收到以下错误
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 'NOT NULL DEFAULT 'NULL',
`designer` INTEGER NULL,
`firstLaunch` TIMESTAMP NU' at line 3
是什么导致了这个错误?
最佳答案
SQLFiddle 使用 mysql。尝试设置 varchar
的大小:
CREATE TABLE `fontFamilies` (
`id` INTEGER NULL AUTO_INCREMENT DEFAULT NULL,
`name` VARCHAR(100) NOT NULL DEFAULT 'NULL',
`designer` INTEGER NULL,
`firstLaunch` TIMESTAMP NULL DEFAULT NULL,
`lastUpdate` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
您还可以将 insert
命令添加到同一窗口:
insert into `fontFamilies` values(217,'name',217,'1992-10-10 10:10:10','1992-10-10 10:10:10')
关于mysql - 简单sql建表语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30828706/