Noor Chaudhry February 2016

MYSQL column containing % symbol

I am trying to create a table with a the column name aggregate_report_90%_line in mysql. I am getting a syntax error because of the % symbol. How do I create a column with % symbol?

Answers


recycler February 2016

You have to escape it with \% . But it is not a good style. Avoid it. http://dev.mysql.com/doc/refman/5.7/en/string-literals.html

You should avoid it because '%' is a special symbol which can be used in select queries as a wildcard.


Aleksey Ratnikov February 2016

You should always qoute it with backticks:

`aggregate_report_90%_line`

Post Status

Asked in February 2016
Viewed 1,725 times
Voted 7
Answered 2 times

Search




Leave an answer