I have a table in a MySQL table with a fieldname 'product', and want to rename it to 'ds-product'.
The CMS type system I am using uses the id of formfields as the name of the table field to insert into.
For most this works fine, but for a particular field it prepends 'ds-' to whatever ID I give it, so I must make the table field name match.
However, when trying to do a query I get the error that
Unknown column 'sales.ds' in 'field list'
Is there any way I can have a field called ds-product?
Yes, you can use punctuation, white space, international characters, and SQL reserved words if you use delimited identifiers:
SELECT * FROM `my-table`;
In MySQL, use the back-ticks. In standard SQL, use double-quotes.
Or if you use MySQL you can set the
ANSI_QUOTES SQL mode:
SET SQL_MODE = ANSI_QUOTES; SELECT * FROM "my-table";