bbe
bbe

Reputation: 344

MySQL syntax. Is it allowed to use space between table name, dot, and field name?

In MySQL, is it allowed to use space b/w table name, dot, and field name?

e.g., tableName . fieldName ?

Is it allowed in other SQLs?

Upvotes: 0

Views: 394

Answers (1)

Bohemian
Bohemian

Reputation: 425033

Whitespace is officially allowed by the sql standard, and MySQL (and all databases AFAIK) allow whitespace in this situation.

That said, I have lost an hour or so of my life due to MySQL's quirky whitespace requirements in other places, for example:

Space required after -- for a comment (not SQL standard):

-- A comment
--A Syntax error (but a comment in other databases)

And this insidious implementation:

CAST(something as sometype) -- OK
CAST (something as sometype) -- syntax error

And I'm quite sure there are more surprises lurking.

Upvotes: 3

Related Questions