带有MySQL的列名中的空格

时间:2022-12-03 00:14:32

One of the column names in my database is two words long, including a blank space, i.e.: Area One. I am using SELECT and referring to the column names to pull the data I want. Now if I name the column _Area_One_, my SELECT works, but if I use _Area One_, it does not. It says Unknown column 'Area' in 'field list'

我的数据库中的一个列名是两个字长,包括一个空格,即:Area One。我正在使用SELECT并引用列名来提取我想要的数据。现在如果我将列命名为_Area_One_,我的SELECT工作,但如果我使用_Area One_,它不会。它在'字段列表'中显示未知列'区'

Ideas?

1 个解决方案

#1


19  

Use backticks.

SELECT * FROM `Area One`

#1


19  

Use backticks.

SELECT * FROM `Area One`