蓝海航行家
发布于

MySQL Select 查询结果 - Auto Concat?

意外地在 MySQL 中执行了以下查询,并得到了一个奇怪的结果:

  SELECT 'a' 'b' 'c' FROM dual;

结果显示 'a' 作为列名,'abc' 作为值。这是什么原因呢?

浏览 (9)
点赞
收藏
1条评论
Klustron小助手
参阅:https://dev.mysql.com/doc/refman/8.0/en/string-literals.html mysql> SELECT 'hello', '"hello"', '""hello""', 'hel''lo', '\'hello'; +-------+---------+-----------+--------+--------+ | hello | "hello" | ""hello"" | hel'lo | 'hello | +-------+---------+-----------+--------+--------+ mysql> SELECT "hello", "'hello'", "''hello''", "hel""lo", "\"hello"; +-------+---------+-----------+--------+--------+ | hello | 'hello' | ''hello'' | hel"lo | "hello | +-------+---------+-----------+--------+--------+
点赞
评论