tags:

views:

98

answers:

3

I have field name category_id in product table.

And also I want name field of category id as category-id.

Is there any good reasons that I should not use - in a field name?

Where can I find which character I should not use in MySQL field and table name?

+5  A: 

The major reason against use of hyphen is that most references must then quote the field names. Otherwise they will look like a subtraction operator, both to MySQL and humans.

wallyk
A: 

You can take a look at the reserved words list

Generally, you can use whatever name you wish as long as you wrap it in backquotes.

kemp
+1  A: 

Safest bet is to stick with alphanumerics + _. Thats pretty standard in terms of "safe" naming, as none of those characters can be misrepresented as operator symbols.

cyberconte