1

Topic: Syntax error at creation to the table in Workbench

Kind time of days!
Created a DB, selected it and tried to create in it the table. A script I register as in textbooks it is written, but Workbench produces an error (syntactic) and does not compile. I will not understand in what an error as he specifies that should not be an error.
Prompt please in what the reason and how to correct.

SHOW DATABASES;
USE climate;
DATABASES changed CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT);
CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT)

Answers Workbench:
01:58:21 show databases 7 row (s) returned 0.000 sec / 0.000 sec
01:59:23 use climate 0 row (s) affected 0.000 sec
02:00:50 databases changed CREATE TABLE Climate (indexses tinyint, Region_of_the_World enum, Country enum, Locality varchar (30), Years timestamp, Months enum, Days enum, Temperature tinyint, Vlagnoste tinyint, Direction_of_the_wind varchar (5), Speed_of_wind tinyint) Error Code: 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 ' databases changed CREATE TABLE Climate (indexses tinyint, Region_of_the_World enu ' at line 1 0.000 sec
02:11:24 databases changed CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT) Error Code: 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 ' databases changed CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_IN ' at line 1 0.000 sec
02:11:53 CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT) Error Code: 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 ' Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, T ' at line 1 0.000 sec
02:20:35 CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT) ENGINE=InnoDB DEFAULT CHARSET=UTF8 Error Code: 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 ' Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, T ' at line 1 0.000 sec
[img =]

2

Re: Syntax error at creation to the table in Workbench

In the third line any nonsense. Such command does not exist. It seems that the output of execution of the previous command got to it.
As CREATE TABLE is in the fourth line third it is possible to throw out simply.

3

Re: Syntax error at creation to the table in Workbench

miksoft, tried - an error.

show databases;
use climate;
CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT);

19:05:19 show databases 7 row (s) returned 0.000 sec / 0.000 sec
19:05:40 use climate 0 row (s) affected 0.000 sec
19:07:04 CREATE TABLE Climate (indexses INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Region_of_the_World ENUM, Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, Temperature INT, Vlagnoste INT, Direction_of_the_wind VARCHAR (5), Speed_of_wind INT) Error Code: 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 ' Country ENUM, Locality VARCHAR (30), Years TIMESTAMP, Months ENUM, Days ENUM, T ' at line 1 0.000 sec

4

Re: Syntax error at creation to the table in Workbench

Vlad __ i __ mir;
At type ENUM it is necessary to declare the list of possible values explicitly still. See The ENUM Type .
And generally - would not recommend to contact data type ENUM if for this purpose there is no especial reason.

5

Re: Syntax error at creation to the table in Workbench

miksoft, thanks! The error is eliminated.