
如果表名有空格,则需要在表名周围使用反引号。让我们首先创建一个表。 在这里,我们使用了反引号 - mysql> create table `Demo Table138`
(
Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
Price int
);
Query OK, 0 rows affected (0.47 sec) 登录后复制 使用插入命令在表中插入记录 - mysql> insert into `Demo Table138`(Price) values(450);
Query OK, 1 row affected (0.18 sec)
mysql> insert into `Demo Table138`(Price) values(499);
Query OK, 1 row affected (0.16 sec)
mysql> insert into `Demo Table138`(Price) values(199);
Query OK, 1 row affected (0.17 sec)
mysql> insert into `Demo Table138`(Price) values(3090);
Query OK, 1 row affected (0.21 sec) 登录后复制 使用选择命令显示表中的记录 - 以下是从表名中包含空格的表中选择数据的查询 - mysql> select *from `Demo Table138`; 登录后复制 这将产生以下输出 - +----+-------+
| Id | Price |
+----+-------+
| 1 | 450 |
| 2 | 499 |
| 3 | 199 |
| 4 | 3090 |
+----+-------+
4 rows in set (0.00 sec) 登录后复制 |