2017-07-09 120 views
-2

这似乎是一个相当琐碎的问题,但我有在运行下面的查询没有运气:MySQL错误1064表创建

create table if not exists tweet_data (
created_at DATETIME, 
user_name VARCHAR(20), 
retweet_count INT, 
favourite_count INT, 
tweet_followers_count INT, 
is_retweet BOOLEAN, 
tweet_source VARCHAR(256), 
user_location VARCHAR(256), 
tweet_mentioned_count INT, 
tweet_ID VARCHAR(256) NOT NULL, 
tweet_text VARCHAR(140), 
UNIQUE (tweet_ID)); 

当我运行此我得到以下错误信息:

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 '(20), retweet_count INT,  favourite_count INT,  
tweet_followers_count ' at line 3 

当我将鼠标悬停在第3行的错误标签,它说:

Syntax error : unexpected '(' (opening parenthesis) 

我敢肯定,这是一个简单的解决,任何帮助将太好了!

+3

应该是'USER_NAME VARCHAR(20)'无R之间的空间( – fg78nc

+0

是不是因为(20)中的空间和user_name列中的VARCHAR? – noobcode

+0

尝试此操作,但仍然收到相同的错误,不幸的是,将编辑删除上面的空间 –

回答

0

原来是与MySQL Workbench中错误

0

创建表,如果不存在tweet_data(

created_at DATETIME,

USER_NAME VARCHAR(20),

retweet_count INT,

favourite_count INT,

tweet_followers_count INT,

is_retweet BOOLEAN,

tweet_source VARCHAR(256),

USER_LOCATION VARCHAR(256),

tweet_mentioned_count INT,

tweet_ID VARCHAR(256)NOT NULL,

tweet_text VARCHAR( 140),

UNIQUE(tweet_ID));

这段代码完美运行。

去这个链接,并检查你的自我

http://rextester.com/l/mysql_online_compiler

+0

不幸的是,这将返回相同的错误。 –