您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MYSQL中如何从表名有空格的表中选取数据?

2024/3/31 23:43:36发布16次查看
如果表名有空格,则需要在表名周围使用反引号。让我们首先创建一个表。
在这里,我们使用了反引号 -
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)
以上就是mysql中如何从表名有空格的表中选取数据?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product