Reputation: 1
I am experiencing following problem with my MYSQL query:
Error #1064 - 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 '(14) NOT NULL, station varchar(4) NOT NULL default '', PRIMARY KEY (stati' at line 2
The query is as follow:
CREATE TABLE metars (
timestamp timestamp(14) NOT NULL,
station varchar(4) NOT NULL default '',
PRIMARY KEY (station),
UNIQUE KEY station (station)
);
Thank you very much in advance for helping me with understanding this problem.
Upvotes: 0
Views: 960
Reputation: 12401
why are you using 14? this worked for me.
CREATE TABLE metars (
timestamp timestamp NOT NULL,
station varchar(4) NOT NULL default '',
PRIMARY KEY (station),
UNIQUE KEY station (station)
);
Upvotes: 0
Reputation: 255115
The error is caused by malicious (14)
fraction.
In mysql the timestamp
type is not parameterized.
So the correct definition for the first column would be
timestamp TIMESTAMP NOT NULL,
Upvotes: 2