On Thu, Feb 24, 2011 at 12:06 PM, Dave M G <d...@articlass.org> wrote:

> Should I never use the word "group" for column names? Seems a little
> silly. Is there a way to protect column names to that there is no
> confusion?
>

As several people already pointed out, simply use backticks. Simple quotes
have started to work in more and more places in newer versions of MySQL.

However, it is considered bad form to name columns for reserved words - even
ones as obvious as "group" or "index". Bad form in the same way that you
wouldn't name any variables "define" or "if" while programming; or in a very
similar way that you wouldn't put a box of TNT next to a burning candle -
it's an accident waiting to happen.

The escapes are there in case an upgrade creates new reserved words that
you've already used in column names - "partition" comes to mind - but if you
are still in a phase where you can avoid using reserved words, please spare
yourself and others a lot of trouble and do so; even if only because while
you can fix your code, you can't fix someone else's - think management
tools, backup scripts, whatever may touch the db in the future.


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

Reply via email to