2015-01-13 94 views
0
CREATE TABLE IF NOT EXISTS `info` (
    `roll_no` integer(10) NOT NULL, 
    `name` varchar(45) NULL, 
    `fname` varchar(45) NULL, 
    `reg_no` varchar(45) NULL, 
    `cnic` varchar(45) NULL, 
    `sesion` varchar(45) NULL, 
    `prog` varchar(50) NULL, 
    `cent` varchar(50) NULL, 
    `inst` varchar(50) NULL, 
    `exam` varchar(50) NULL, 
    PRIMARY KEY (`roll_no`), 
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 

錯誤:我想創造一個表,但它給了我錯誤1046

#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 DEFAULT CHARSET=latin1' at line 13 

回答

1

PRIMARY KEY (`roll_no`), 
        ^right there 
0

的末尾刪除逗號也許這是PRIMARY KEY (roll_no)後多餘的逗號

3

刪除PRIMARY KEY後的額外逗號。使用此SQL查詢

CREATE TABLE IF NOT EXISTS `info` (
    `roll_no` integer(10) NOT NULL, 
    `name` varchar(45) NULL, 
    `fname` varchar(45) NULL, 
    `reg_no` varchar(45) NULL, 
    `cnic` varchar(45) NULL, 
    `sesion` varchar(45) NULL, 
    `prog` varchar(50) NULL, 
    `cent` varchar(50) NULL, 
    `inst` varchar(50) NULL, 
    `exam` varchar(50) NULL, 
    PRIMARY KEY (`roll_no`) 
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 

希望這有助於你

1

通過檢查後

PRIMARY KEY (`roll_no`), 

刪除逗號,然後如果存在錯誤,那麼它是舊版本..

相關問題