Page 1 of 1
Are you getting an error with what should be good SQL?
Posted: Tue Aug 28, 2007 12:22 pm
by ReverendDexter
I've noticed that about 1 out of every 10 post here are errors that are good SQL that just happens to fail because of the use a reserved word. So, if you know your SQL should be good, check this:
http://dev.mysql.com/doc/refman/5.0/en/ ... words.html
I apologize if this is already posted/obvious/unecessary, just seemed to be seeing it a lot lately.
Posted: Tue Aug 28, 2007 12:32 pm
by John Cartwright
.. which is why you should always wrap your table and column names in backticks to avoid current (and future) reserved name collisions

Posted: Tue Aug 28, 2007 12:53 pm
by AKA Panama Jack
Jcart wrote:.. which is why you should always wrap your table and column names in backticks to avoid current (and future) reserved name collisions

No, you should avoid reserved words period. The backtick is a way to cover poor SQL coding practices. Also, if you are writing portable SQL code backticks are not supported by all SQL database systems.
Posted: Tue Aug 28, 2007 1:43 pm
by John Cartwright
AKA Panama Jack wrote:Jcart wrote:.. which is why you should always wrap your table and column names in backticks to avoid current (and future) reserved name collisions

No, you should avoid reserved words period. The backtick is a way to cover poor SQL coding practices. Also, if you are writing portable SQL code backticks are not supported by all SQL database systems.
I would beg to differ. It is impossible to know any future reserved words collisions. Better safe than sorry.
Posted: Tue Aug 28, 2007 2:21 pm
by VladSun
Jcart wrote:I would beg to differ. It is impossible to know any future reserved words collisions. Better safe than sorry.
That is backward compatibility for.
Posted: Tue Aug 28, 2007 4:14 pm
by superdezign
AKA Panama Jack wrote:No, you should avoid reserved words period.
What for? They are generally descriptive.
Posted: Tue Aug 28, 2007 5:21 pm
by CoderGoblin
I tend to agree with avoiding use of reserved words. With a "good", meaningful naming scheme you are unlikely to have conflicts including in the future. It has often come to my attention that often we try to shorten things uneccessarily to make it easier for us to type queries. In reality this might make life easier in the short term but makes the code and logic far less maintainable in the long run. After all how many of us actually comment our tables or document our databases properly ? I say this knowing it is something I normally "skip".
Posted: Tue Aug 28, 2007 6:24 pm
by CoderGoblin
Ok have to also say that having a list of reserved words is useful... Here are some quick link I found by using a favourite search engine...
postgres
Sql Server
Oracle
A utility which may be useful