在预期的位置找不到FROM关键字(Oracle SQL)
我目前正在处理一些选择查询,并且在最近两个查询中都收到错误FROM keyword not found where expected
,我一辈子都无法弄清楚问题出在哪里...
I am currently working on some select queries and am getting the error FROM keyword not found where expected
in my last two queries, and I can;t for the life of me figure out what the problem is...
这是我的查询
SELECT Title, PubID AS 'Publisher ID', PubDate AS 'Publish Date'
FROM Books WHERE PubID = 4 OR PubDate > '01-Jan-01'
ORDER BY PubID ASC;
SELECT Title, (((Retail-Cost)/Cost) * 100) AS 'Markup %'
FROM Books;
我不确定在这个(retail - cost / cost * 100 is the goal)
中我的数学是否正确.
I am not sure if my math is correct in this one (retail - cost / cost * 100 is the goal)
.
在放弃并进行最后一个查询之前,我一直在尝试处理第一个查询大约45分钟,以便在该查询上仅遇到相同的错误.
I have been trying for probably 45 minutes on the first query before giving up and doing the last one, to only get the same error on that one.
单引号用于包围字符串文字.双引号用于将标识符引起来.列别名是标识符,因此您想使用双引号
Single quotes are used to surround string literals. Double quotes are used to surround identifiers. Column aliases are identifiers so you'd want to use double quotes
SELECT Title,
PubID AS "Publisher ID",
PubDate AS "Publish Date"
FROM Books
WHERE PubID = 4
OR PubDate > '01-Jan-01'
ORDER BY PubID ASC;