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.
Are you getting an error with what should be good SQL?
Moderator: General Moderators
- ReverendDexter
- Forum Contributor
- Posts: 193
- Joined: Tue May 29, 2007 1:26 pm
- Location: Chico, CA
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
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.Jcart wrote:.. which is why you should always wrap your table and column names in backticks to avoid current (and future) reserved name collisions
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I would beg to differ. It is impossible to know any future reserved words collisions. Better safe than sorry.AKA Panama Jack wrote: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.Jcart wrote:.. which is why you should always wrap your table and column names in backticks to avoid current (and future) reserved name collisions
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
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".
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
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
postgres
Sql Server
Oracle
A utility which may be useful