Re: SQL statement
| From: | Curt Zirzow | Date: | Wed, 24 Sep 2003 01:47:19 +0000 |
| Subject: | Re: SQL statement | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163681@lists.php.net to get a copy of this message | ||
* Thus wrote Jennifer Goodie (goodie@apollointeractive.com):
> > http://www.mysql.com/doc/en/Reserved_words.html
> >
> > [snip]
> > 6.1.7 Is MySQL Picky About Reserved Words?
> >
> > A common problem stems from trying to create a table with column
> > names that use the names of datatypes or functions built into
> > MySQL, such as TIMESTAMP or GROUP. You're allowed to do it (for
> > example, ABS is allowed as a column name). However, by default,
> > in function invocations no whitespace is allowed between the
> > function name and the following `(' character, so that a function
> > call can be distinguished from a reference to a column name.
> > [/snip]
> >
> If you keep scrolling on the page you gave the link for, you'll get to a
> list of reserved words and notice that timestamp is not reserved. In fact
> if you scroll even farther, you will see that it is explicitly allowed in
> mySQL, but that doesn't mean using it is a good idea.
>
> > try renaming the field timestamp to something else and see if that helps?
> >
> If you are using a reserved word and renaming is not an option you can use
> the backtick operator ` to escape it.
As you said ealier, I wouldn't leave reserve words in a table
strucure. I've had people name columns like
from using that
backtick operator... good luck trying to select that field..
select from from table1
Do you know off hand if this backtick is ansi sql?
Curt
--
"I used to think I was indecisive, but now I'm not so sure."