不,我们不可以。要解决此问题,请在字段名称周围使用反引号。我们首先创建一个表,其表名带有星号`Name *`-
mysql> create table DemoTable -> ( -> `Name*` varchar(20) -> );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable(`Name*`) values('Chris Brown'); mysql> insert into DemoTable(`Name*`) values('David Miller'); mysql> insert into DemoTable(`Name*`) values('John Doe'); mysql> insert into DemoTable(`Name*`) values('John Smith');
使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
这将产生以下输出-
+--------------+ | Name* | +--------------+ | Chris Brown | | David Miller | | John Doe | | John Smith | +--------------+ 4 rows in set (0.00 sec)
以下是查询以选择包含星号的字段名称-
mysql> select `Name*` from DemoTable;
这将产生以下输出-
+--------------+ | Name* | +--------------+ | Chris Brown | | David Miller | | John Doe | | John Smith | +--------------+ 4 rows in set (0.00 sec)