在PostgreSQL中查询数据

时间:2019-03-13 07:13:40

标签: sql postgresql quoted-identifier

我不确定发生了什么或做错了什么。 Postgre的新手,我已经在程序中添加了三个表,但是查询这三个表时遇到了麻烦。当我运行第一个数据库Departments时,生成结果没有问题。

SELECT * from public."Departments";

输出

"Customer Service"  1
"Receivable Management" 2
"HR"    3

查询:

SELECT id from public."Departments"

输出

1
2
3

但是,当我尝试对其他任何表使用相同的代码时,它可以用于选择所有行:

查询:

SELECT * FROM public."Manager_data"

输出

ID  First_name  Last_name Department  Hire_date
1   "Jamie" "Holland"   "Customer Service"  "2013-01-05"
2   "Samuel"    "Stuart"    "Recievable Management" "2014-04-15"
3   "Lana"  "Lang"  "Customer Service"  "2014-06-06"
4   "Kristen"   "Callen"    "Recievable Management" "2015-05-27"
5   "Mary"  "Louise"    "Customer Service"  "2015-07-07"

但是当我尝试选择一行时给了我一个错误:

查询:

SELECT Hire_date from public."Manager_data"

输出

 ERROR:  column "hire_date" does not exist
 LINE 1: SELECT Hire_date from public."Manager_data"
                ^
 HINT:  Perhaps you meant to reference the column "Manager_data.Hire_date".
 SQL state: 42703
 Character: 8

不知道我在做什么错。我已经尝试了建议的提示,但是那也不起作用。

0 个答案:

没有答案