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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With