sql:为注入制作表结构

发布于 2024-10-02 01:32:30 字数 702 浏览 0 评论 0原文

我想从此网站 对于我的数据库中的国家/地区表。

问题是他们不提供表结构,所以我必须创建一个,但我无法正确 - 当我想将数据注入到我创建的表中时,我的 phpMyAdmin 不断显示错误:

#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的 'NUMERIC, alpha3, name,ficialName) VALUES ('004','AFG','Afghanistan','Afghan' 附近使用的正确语法

--
-- Table structure for table `countrytable`
--

CREATE TABLE IF NOT EXISTS `countrytable` (
  `NUMERIC` int(11) NOT NULL,
  `alpha3` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `officialName` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

我认为我的表结构不正确,如何修复?

I want to take the values from this site for the country table in my database.

The problem is that they don't provide the table structure, so I have to create one, but I cannot get it right - my phpMyAdmin keeps displaying an error when I want to inject the data into the table I created below:

#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 'NUMERIC, alpha3, name, officialName) VALUES ('004','AFG','Afghanistan','Afghan' at line 1

--
-- Table structure for table `countrytable`
--

CREATE TABLE IF NOT EXISTS `countrytable` (
  `NUMERIC` int(11) NOT NULL,
  `alpha3` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `officialName` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I think my table structure is incorrect. How can I fix it? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

本宫微胖 2024-10-09 01:32:30

尝试所有 varchar 字段来获取数据,因为所有字段都在您拥有的字符串中的引号中。

Try all varchar fields to get the data in since all fields are in quotes in the string you have.

长伴 2024-10-09 01:32:30

NUMERIC是mysql中的保留字
添加反勾号或引用它 -> http://dev.mysql.com/doc/refman/5.1 /en/reserved-words.html

NUMERIC is reserved word in mysql
add in back-tick or quote it -> http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

白色秋天 2024-10-09 01:32:30

`alpha3` 应该是 varchar(3) (或更大),而不是 int(11)。

`alpha3` should be a varchar(3) (or larger), not an int(11).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文