I hate to dampen your spirits but I think you have made a poor design 
choice. 

<BEGIN GLOOM and DOOM>

The word "key" is a reserved word in MySQL. In order to assign to a 
database object a name that is either a reserved word or a name that uses 
a special character, you must surround that with a pair of backticks, ``. 
Those are not to be confused with a pair of single quotes, ''. 

Read here for details:
http://dev.mysql.com/doc/mysql/en/Reserved_words.html
http://dev.mysql.com/doc/mysql/en/Legal_names.html

BE VERY WARNED: once you create this table you will ALWAYS need to refer 
to that column by surrounding its name with backticks.  May I suggest you 
use an alternate spelling (like "key_") or an alternate name (like "id") 
for your column to avoid needing backticks? Anyway, if you _must_ keep 
your current design choice:

CREATE TABLE backticktest
        `key` int auto_increment,
        data varchar(100) null,
        PRIMARY KEY(`key`)
)

Just to add to my warning, here is a sample select:

SELECT `key`,data from backticktest where `key`=15;

If you forget those backticks, your query WILL FAIL.

<END GLOOM and DOOM> :-)

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Pahlevanzadeh Mohsen <[EMAIL PROTECTED]> wrote on 09/10/2004 
09:49:00 AM:

> Dears,
> I need to define a column within my table.I want to
> name it "key".Also i need to it is auto_increment &
> not null.Also i want to it is primary key.
> Please tell its statement.
> Yours,Mohsen
> 
> 
> =====
> ---------DIGITAL  SIGNATURE-------------------
> ///Mohsen Pahlevanzadeh////////
>      Network administrator  & programmer 
>       My home phone is: +98213810146 
> My email address is 
>           m_pahlevanzadeh at yahoo dot com 
> My website is: http://webnegar.net 
> ----------------------------------------------------------------
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to