gpt4 book ai didi

database - 列在 Postgresql 中不存在

转载 作者:行者123 更新时间:2023-11-29 14:20:44 26 4
gpt4 key购买 nike

我创建了一个表:

CREATE TABLE LuxRoom
(
roomID INT NOT NULL PRIMARY KEY CONSTRAINT roomID_ref_room REFERENCES Room(roomID),
peopleNumber INT NOT NULL,
additionalService TEXT
)

但是当我像这样插入时:

INSERT INTO LuxRoom(roomID, peopleNumber, additionalService) VALUES(1, 2, "Extra food, a cab");

我收到这个错误:

ERROR:  column "Extra food, a cab" does not exist

问题是什么?

最佳答案

Single quotes delimit a string constant or a date/time constant.

Double quotes delimit identifiers for e.g. table names or column names. This is generally only necessary when your identifier doesn't fit the rules for simple identifiers.

用单引号替换双引号

INSERT INTO LuxRoom (roomID, peopleNumber, additionalService) 
VALUES (1, 2, 'Extra food, a cab');

关于database - 列在 Postgresql 中不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28293646/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com