0
我想創建一個產品表上運行下面的SQL查詢:SQL產品表創建 - 語法錯誤
CREATE TABLE ‘products’ (
‘id’ INT NOT NULL AUTO_INCREMENT ,
‘name’ VARCHAR(255) NOT NULL ,
‘shortdesc’ VARCHAR(255) NOT NULL ,
‘longdesc’ TEXT NOT NULL ,
‘thumbnail’ VARCHAR(255) NOT NULL ,
‘image’ VARCHAR(255) NOT NULL ,
‘sizes’ ENUM(‘s’, ‘m’, ‘l’, ‘xl’) NOT NULL ,
‘colors’ ENUM(‘red’, ‘blue’, ‘green’, ‘brown’, ‘white’, ‘black’) NOT NULL ,
‘grouping’ VARCHAR(16) NOT NULL ,
‘status’ ENUM(‘active’, ‘inactive’) NOT NULL ,
‘category_id’ INT NOT NULL ,
‘featured’ ENUM (‘true’, ‘false’) NOT NULL,
‘price’ FLOAT(4, 2) NOT NULL,
PRIMARY KEY (‘id’)
) TYPE = MYISAM ;
但出現此錯誤:
#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 '‘s’, ‘m’, ‘l’, ‘xl’) NOT NULL , ‘colors’ ENUM(‘red’, ' at line 8
我應該使用哪種類型?我正在以一本書爲例。
謝謝!這是問題,它現在正在工作:) – m1243 2012-03-15 00:11:37
太棒了!繼續接受詹姆斯的回答(他是第一個發佈的)。 – ScottJShea 2012-03-15 00:13:03