FROM keyword not found where expected (Oracle SQL)

Multi tool use
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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...
Here are my queries
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;
I am not sure if my math is correct in this one (retail - cost / cost * 100 is the goal)
.
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.
mysql sql oracle
add a comment |
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...
Here are my queries
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;
I am not sure if my math is correct in this one (retail - cost / cost * 100 is the goal)
.
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.
mysql sql oracle
4
You need to use double quote ("
) instead of single quotes in your column aliases. Use aliases asPubID AS "Publisher ID"
and you'll be fine.
– Rachcha
Mar 31 '14 at 4:14
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56
add a comment |
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...
Here are my queries
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;
I am not sure if my math is correct in this one (retail - cost / cost * 100 is the goal)
.
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.
mysql sql oracle
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...
Here are my queries
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;
I am not sure if my math is correct in this one (retail - cost / cost * 100 is the goal)
.
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.
mysql sql oracle
mysql sql oracle
edited Mar 31 '14 at 4:21
JasonMArcher
9,461104849
9,461104849
asked Mar 31 '14 at 4:12
MetaMeta
89241526
89241526
4
You need to use double quote ("
) instead of single quotes in your column aliases. Use aliases asPubID AS "Publisher ID"
and you'll be fine.
– Rachcha
Mar 31 '14 at 4:14
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56
add a comment |
4
You need to use double quote ("
) instead of single quotes in your column aliases. Use aliases asPubID AS "Publisher ID"
and you'll be fine.
– Rachcha
Mar 31 '14 at 4:14
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56
4
4
You need to use double quote (
"
) instead of single quotes in your column aliases. Use aliases as PubID AS "Publisher ID"
and you'll be fine.– Rachcha
Mar 31 '14 at 4:14
You need to use double quote (
"
) instead of single quotes in your column aliases. Use aliases as PubID AS "Publisher ID"
and you'll be fine.– Rachcha
Mar 31 '14 at 4:14
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56
add a comment |
1 Answer
1
active
oldest
votes
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;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22753519%2ffrom-keyword-not-found-where-expected-oracle-sql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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;
add a comment |
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;
add a comment |
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;
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;
answered Mar 31 '14 at 4:15
Justin CaveJustin Cave
190k18292324
190k18292324
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22753519%2ffrom-keyword-not-found-where-expected-oracle-sql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
JA3LJz B4 Z yW4 mYS3do4kU3jNipJMvozIxj,i
4
You need to use double quote (
"
) instead of single quotes in your column aliases. Use aliases asPubID AS "Publisher ID"
and you'll be fine.– Rachcha
Mar 31 '14 at 4:14
Which database are you actually using? You've tagged this for both Oracle and MySQL.
– Justin Cave
Mar 31 '14 at 4:16
@Rachcha that did the trick, idk how I didnt notice that or find anything anywhere else I was looking and pickup on the fact that it was double quotes... Been a long weekend for me I guess!
– Meta
Mar 31 '14 at 4:56