使用 MySQL,我尝试在数据库中创建一个表,然后插入,但得到一个“语法”:错误
这是创建表:
create table lawyer_info
(firm_name varchar(100),
firm_url varchar(100),
firm_address varchar(100),
firm_city varchar(100),
firm_state varchar(100),
firm_zip int(5),
firm_phone varchar(12));
这是插入:
insert into lawyer_info ('firm_name','firm_url','firm_address','firm_city','firm_state','firm_zip','firm_phone')
values('Leona Beane','http://www.lawyerlbeane.com/','11 Park Place, Suite 1100','New York','NY','10007','212-608-0919'),
values('Morton S. Minsley','http://www.msmlawfirm.com/','101 Lafayette Street, 10th Floor ','New York','NY','10013','212-346-0849'),
values('Steven K. Schwartz, P.A.,','http://www.stevenkschwartzpa.com/','20801 Biscayne Blvd','Aventura','FL','33180','305-936-8844'),
values('Robert H. Feldman','http://www.lawyers.com/rhfeldman/','3550 North Central Avenue, Suite 1500','Phoenix','AZ','85012','602-265-1074'),
values('Joseph M. Udall, PLC','http://www.udallattorneys.com/','18 East University, Drive,Suite 201','Mesa','AZ','85201','480-222-0398');`
我不明白的是为什么我得到:
#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的 ''firm_name'、'firm_url'、'firm_address'、'firm_city'、'firm_state'、'firm_zip'、'firm_' 附近使用的正确语法
Here's the create table:
create table lawyer_info
(firm_name varchar(100),
firm_url varchar(100),
firm_address varchar(100),
firm_city varchar(100),
firm_state varchar(100),
firm_zip int(5),
firm_phone varchar(12));
and here's the insert:
insert into lawyer_info ('firm_name','firm_url','firm_address','firm_city','firm_state','firm_zip','firm_phone')
values('Leona Beane','http://www.lawyerlbeane.com/','11 Park Place, Suite 1100','New York','NY','10007','212-608-0919'),
values('Morton S. Minsley','http://www.msmlawfirm.com/','101 Lafayette Street, 10th Floor ','New York','NY','10013','212-346-0849'),
values('Steven K. Schwartz, P.A.,','http://www.stevenkschwartzpa.com/','20801 Biscayne Blvd','Aventura','FL','33180','305-936-8844'),
values('Robert H. Feldman','http://www.lawyers.com/rhfeldman/','3550 North Central Avenue, Suite 1500','Phoenix','AZ','85012','602-265-1074'),
values('Joseph M. Udall, PLC','http://www.udallattorneys.com/','18 East University, Drive,Suite 201','Mesa','AZ','85201','480-222-0398');`
What I don't get is why I'm getting:
#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 ''firm_name','firm_url','firm_address','firm_city','firm_state','firm_zip','firm_' at line 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
列名应该不加引号,或者在 MySQL 中加反引号:
Column names should be unquoted, or backtick quoted in MySQL:
您不应该引用您的属性名称。例如,
You shouldn't quote your attribute names. e.g.,
你不应该使用普通的引号,而应该使用反引号作为你的列名称......它应该是
You shouldn't use normal quotes, but backticks for your colum names... it should be