MySQL数据库中的语法错误创建表

时间:2016-02-23 19:19:54

标签: mysql sql

当我尝试在MySQL数据库中创建表时,我遇到语法错误,它位于MEDIUMBLOB附近,任何人都可以帮助我吗?

CREATE TABLE  `ELO`.`images` (

 `image_id` VARCHAR( 50 ) NOT NULL ,
 `user_id` VARCHAR( 50 ) NOT NULL ,
 `image` MEDIUMBLOB(16777215) NOT NULL ,
 `longitude` VARCHAR( 15 ) NOT NULL ,
 `latitude` VARCHAR( 15 ) NOT NULL ,
 `city` VARCHAR( 50 ) NOT NULL ,
 `delete_at` DATETIME NOT NULL ,
 `description` VARCHAR( 250 ) NOT NULL ,
 `score` INT( 8 ) NOT NULL DEFAULT  '0',
 `categories` SET(  'nightlife',  'food',  'beach' ) NOT NULL DEFAULT  'nightlife',
PRIMARY KEY (  `image_id` ) ,
UNIQUE (
 `image`
)
) ENGINE = MYISAM

1 个答案:

答案 0 :(得分:0)

您无法设置MEDIUMBLOB image MEDIUMBLOB NOT NULL,的长度,只应UNIQUE定义该列,这意味着您无法将其设置为CREATE TABLE `images` ( `image_id` VARCHAR( 50 ) NOT NULL , `user_id` VARCHAR( 50 ) NOT NULL , `image` MEDIUMBLOB NOT NULL, `longitude` VARCHAR( 15 ) NOT NULL , `latitude` VARCHAR( 15 ) NOT NULL , `city` VARCHAR( 50 ) NOT NULL , `delete_at` DATETIME NOT NULL , `description` VARCHAR( 250 ) NOT NULL , `score` INT( 8 ) NOT NULL DEFAULT '0', `categories` SET( 'nightlife', 'food', 'beach' ) NOT NULL DEFAULT 'nightlife', PRIMARY KEY ( `image_id` ) ) ENGINE = MYISAM ,因为它不会{39}} ; t有长度,所以你的SQL应该是这样的

$('#leads-for-purchase , #leads-for-purchase-head').insertBefore('#member-main-newsletter-head');   
$("#leads-for-purchase strong span.green_leads_title_country2,#leads-for-purchase .green_leads_title_country").removeClass("textgreen");