我在SQL中创建一个表但是我得到错误......
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 ' pub_name VARCHAR, pub_city VARCHAR, country ' at line 2
CREATE TABLE publisher(
'pub_id' varchar(8),
'pub_name' varchar(50),
'pub_city' varchar(25),
'country' varchar(25),
'country_office' varchar(25)
'no_of_branch' int(3),
'estd' date);
答案 0 :(得分:1)
您忘记了'country_office'行之后的,
。
顺便说一下,你应该使用反向引号:`围绕每个列名而不是简单的名称!
CREATE TABLE publisher (
`pub_id` varchar(8),
`pub_name` varchar(50),
`pub_city` varchar(25),
`country` varchar(25),
`country_office` varchar(25), <-
`no_of_branch` int(3),
`estd` date );
答案 1 :(得分:0)
CREATE TABLE publisher
(
`pub_id` varchar(8),
`pub_name` varchar(50),
`pub_city` varchar(25),
`country` varchar(25),
`country_office` varchar(25), --The problem is here, You are missing a comma
`no_of_branch` int(3),
`estd` date
);
此外,您应该使用`而不是'
<强> SQL FIDDLE 强>
感谢小提琴The Unlucky
答案 2 :(得分:0)
试试这个
CREATE TABLE publisher(pub_id varchar(8), pub_name varchar(50),
pub_city varchar(25), country varchar(25), country_office varchar(25) , no_of_branch int(3), estd date);