How do I escape reserved words used as column names? MySQL/Create Table

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-05-22T21:43:59Z Indexed on 2010/05/22 22:00 UTC
Read the original article Hit count: 139

Filed under:
|

I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved MySQL keyword. How do I escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique)

create table if not exists misc_info (
id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL)ENGINE=INNODB;

© Stack Overflow or respective owner

Related posts about mysql

Related posts about escape