Noor Chaudhry
Noor Chaudhry

Reputation: 73

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?

Upvotes: 0

Views: 357

Answers (2)

Aleksey Ratnikov
Aleksey Ratnikov

Reputation: 569

You should always qoute it with backticks:

`aggregate_report_90%_line`

Upvotes: 0

recycler
recycler

Reputation: 1471

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.

Upvotes: 3

Related Questions