ehp ehp - 1 year ago 78
MySQL Question

How to select a column name with space between in mysql on liunx/ubuntu

I am working on a project where another developer created table with column names like

'Business Name'
. That is a space between two words. I am a Linux user now; If I run a
statement with 'Business Name' it says there is no columns with name 'Business'.

How can I solve this problem?


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download