2014-02-19 193 views
-1

我試圖在我的gym_system數據庫中創建一個表。這裏是代碼我使用:創建表時出錯SQL

CREATE TABLE `Gym_System`.`login` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    `username` VARCHAR(30) NOT NULL, 
    `password` CHAR(128) NOT NULL, 
) ENGINE = InnoDB; 

不過,我不斷收到此錯誤:

#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 ') ENGINE = InnoDB' at line 5

任何人都可以看到,爲什麼?

回答

7

刪除最後一個逗號

CREATE TABLE `login` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    `username` VARCHAR(30) NOT NULL, 
    `password` CHAR(128) NOT NULL 
    ) ENGINE = InnoDB; 

See fiddle demo

+1

燦爛,非常感謝你 –