-2

I have a table that has some reserved words like this:

| ID | Name | **DESC**   | SIZE      |
| 1  | A    | round      | 2" L X 3"W|
| 2  | B    | Cubic      | 3" L X 3"W| 

Here Desc is keyword and is the column name as well. I get an error when I need to fetch data with query like: SELECT * FROM products where DESC='Cubic'; I get an error with this.

Is there any way to re-design the query (not the table) and get the result?

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

You use backticks to escape the name:

SELECT *
FROM products
WHERE `DESC` = 'Cubic'
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786