Rhino wrote:
>
>
> ----- Original Message -----
> From: Ed <mailto:edward@stripped>
> To: mysql@stripped <mailto:mysql@stripped>
> Sent: Tuesday, October 25, 2005 6:40 PM
> Subject: Problem with syntax 4 creating 1 table
>
> Shawn green was very kindly helping me ouy trying to make mysql
> tables and I thought I had go the hang of it until I get this
> error-any ideas? Thanks a lot
>
> CREATE TABLE PurchasedProducts(
> `int_saleCart` INT AUTO_INCREMENT NOT NULL ,
> `int_ClientID` INT,
> `int_ProductID` INT,
> `int_Quantity` INT,
> `int_saleCart` PRIMARY KEY ( int_saleCart )
> ) ENGINE = MYISAM
>
> MySQL said: Documentation
>
> #1064 - You have an error in your SQL syntax. Check the manual
> that corresponds to your MySQL server version for the right syntax
> to use near 'PRIMARY KEY ( int_saleCart )
> ) ENGINE = MYISAM' at line 6
>
>
> You need a comma before the "PRIMARY KEY" clause. That should solve
> your problem. In other words, change the second last line so that it
> looks like this:
>
> `int_saleCart`, PRIMARY KEY ( int_saleCart )
> ----------^------------------------
Nope, that won't work. Adding a comma leaves two problems: First, while it
makes the part after the comma into proper index creation syntax, it leaves
nonsense before the comma (name of a column with no definition). Second, that
name has already been used as the first column name. Removing `int_saleCart`
from that last line, or removing the whole line and adding "PRIMARY KEY" to the
original column definition of int_saleCart, would fix it.
> Rhino
Michael