在预期的位置找不到FROM关键字(Oracle SQL) [英] FROM keyword not found where expected (Oracle SQL)

查看:200
本文介绍了在预期的位置找不到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;

这篇关于在预期的位置找不到FROM关键字(Oracle SQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆