This content has been marked as final. Show 2 replies
Single-quotes are used to enclose string literals (and, in recent versions, DATE literals).
Double-quotes are used to enclose identifiers (like table and column names) . They are optional (and therefore almost never used) when the name conforms to certain rules for names (starts with a letter, no spaces or special symbols, no lower-case letters, ...).
SELECT 'Hello, world!' AS "My Greeting" FROM dual;
'Hello, world!' is a string literal, so it is enclosed in single-quotes.
My Greeting ------------- Hello, world!
The column alias "My Greeting" is not a normal identifier name: it contans lower-case letters and a space, so it must be enclosed in double-quotes.
The table name DUAL is a normal identifer: it is all capital letters, no spaces. I have the choice of referring to it as "DUAL" (all capital letters, inside double-quotes) or as DUAL, dual, Dual, dUAL, dUaL, ... (without quotes).
what is the difference both of them?Actually: it's best to just forget about the double quotes ;)
Edited by: hoek on Oct 23, 2009 9:22 PM