无法明确的sqlite语法错误

发布于 2025-01-28 03:57:02 字数 485 浏览 2 评论 0原文

我正在尝试创建数据库的语句,并且在10个实体之后,我遇到了这个错误

错误:第83行:近“交易”:语法错误

第一行是第83行,其上下文是创建表的上下文

CREATE TABLE Transaction (
TransactionID INTEGER,
AccountID INTEGER REFERENCES User (AccountID),
ItemID INTEGER REFERENCES Item (ItemID),
Method STRING,
Price INTEGER,
TransactionDate DATE,
PRIMARY KEY (TransactionID)
);

,我似乎找不到问题,并且使用错误的空间无法使用ASCII的建议。通过再次手动编写同一件事来解决。

我什至还没有检查外国钥匙的完整性,而且它没有起作用。希望有人可以对我缺少的东西提供一些见解。

I'm trying out statements for creating a database, and after 10 entities without any issues I ran into this error

Error: Near line 83: near "Transaction": syntax error

The first line is line 83 with it's context of creating a table

CREATE TABLE Transaction (
TransactionID INTEGER,
AccountID INTEGER REFERENCES User (AccountID),
ItemID INTEGER REFERENCES Item (ItemID),
Method STRING,
Price INTEGER,
TransactionDate DATE,
PRIMARY KEY (TransactionID)
);

Now I can't seem to find the issue, and suggestion's of something with ASCII using the wrong space couldn't be solved by writing the same thing again manually.

I haven't even gotten around to checking the integrity of my foreign keys, and it's not working. Hopefully somebody could provide some insight on what I'm missing.

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

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

发布评论

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

评论(1

总以为 2025-02-04 03:57:02

事务是SQLite中的保留名称之一。有关完整列表,请参见在这里。

解决此问题的方法是:

  • 将表名称更改为单词这不是保留的。

  • 使用这些 4个列出的引用标记
    • '关键字'
    • “关键字”
    • [关键字]
    • `关键字

Transaction is one of the reserved names in SQLite. For a full list see here.

Ways to solve this issue are:

  • Change the Table name to a word that isn't reserved.

or

  • Quote the reserved name by using one of these 4 listed quote marks
    • 'keyword'
    • "keyword"
    • [keyword]
    • `keyword`
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文