Reputation: 2043
this might end in a down vote but I can´t see trees because of forest:
running this sql query:
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`)
);
I get following error in 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
What is causing this error?
Upvotes: 0
Views: 284
Reputation: 2940
You must set the size of VARCHAR .
CREATE TABLE `fontFamilies` (
`id` INTEGER NULL AUTO_INCREMENT DEFAULT NULL,
`name` VARCHAR(30) NOT NULL DEFAULT 'NULL',
`designer` INTEGER NULL,
`firstLaunch` TIMESTAMP NULL DEFAULT NULL,
`lastUpdate` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
This will work .
Upvotes: 1
Reputation: 4183
SQLFiddle uses mysql. Try setting the size of 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`)
);
You can also add insert
commands to the same window:
insert into `fontFamilies` values(217,'name',217,'1992-10-10 10:10:10','1992-10-10 10:10:10')
Upvotes: 4