您好,欢迎访问一九零五行业门户网

使用 MySQL 设置列名中的空格?

要在mysql中设置列名中的空格,可以使用反引号的概念。让我们首先创建一个表。以下是查询的语句 −
mysql> create table blankspacesdemo -> ( -> `student id` int not null auto_increment primary key, -> `student full name` varchar(100) -> );query ok, 0 rows affected (0.51 sec)
以下是使用插入命令在表中插入一些记录的查询 -
mysql> insert into blankspacesdemo(`student full name`) values('john smith');query ok, 1 row affected (0.16 sec)mysql> insert into blankspacesdemo(`student full name`) values('carol taylor');query ok, 1 row affected (0.14 sec)mysql> insert into blankspacesdemo(`student full name`) values('david miller');query ok, 1 row affected (0.15 sec)
以下是使用select语句显示表中所有记录的查询:
mysql> select `student id`,`student full name` from blankspacesdemo;
以下是在列名称“学生全名”中显示空格的输出 -
+------------+--------------------+| student id | student full name |+------------+--------------------+| 1 | john smith || 2 | carol taylor || 3 | david miller |+------------+--------------------+3 rows in set (0.00 sec)
以上就是使用 mysql 设置列名中的空格?的详细内容。
其它类似信息

推荐信息