Identifiers may be unquoted or quoted. If unquoted, an identifier must follow these rules:
An identifier may be quoted, in which case it can contain characters such as spaces or dashes that aren't otherwise legal. To quote an identifier, you may enclose it within backtick ('`') characters. If the ANSI_QUOTES SQL mode is enabled, you may also quote an identifier by enclosing it within double quotes ('"'). Quoting causes the identifier syntax rules to be relaxed as follows:
An alias identifier can include any character, but should be quoted if it's a reserved word (such as SELECT or DESC), contains special characters, or consists entirely of digits. Aliases may be quoted within single quotes ('''), double quotes, or backticks. Within a quoted identifier, to include the quote character, double it. If you aren't sure whether an identifier is legal, quote it. It's harmless to put quotes around an identifier that's legal without them. |