Question
This question already has answers here :
[When to use single quotes, double quotes, and backticks in MySQL](/questions/11321491/when-to-use-single-quotes-double-quotes-and- backticks-in-mysql) (13 answers)
Closed 3 years ago.
I am working on a project where another developer created a table with column
names like 'Business Name'
. That is a space between two words. If I run a
SELECT
statement with 'Business Name' it says there is no column with name
'Business'.
How can I solve this problem?
Answer
Generally the first step is to not do that in the first place, but if this is already done, then you need to resort to properly quoting your column names:
SELECT `Business Name` FROM annoying_table
Usually these sorts of things are created by people who have used something like Microsoft Access and always use a GUI to do their thing.