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;
错误:
#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
答案 0 :(得分: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 :(得分:1)
删除
末尾的逗号PRIMARY KEY (`roll_no`),
^ right there
答案 2 :(得分:1)
在
之后删除逗号,
进行检查
PRIMARY KEY (`roll_no`),
然后如果存在错误,则它是旧版本..
答案 3 :(得分:0)
在PRIMARY KEY ( roll_no )