
要在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语句显示表中所有记录的查询:
比格设计
比格设计是135编辑器旗下一款一站式、多场景、智能化的在线图片编辑器
124 查看详情
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 设置列名中的空格?的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/225835.html
微信扫一扫
支付宝扫一扫