Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. mysql> set sql_mode='';
  2. Query OK, 0 rows affected (0.00 sec)
  3.  
  4. mysql>
  5. mysql> drop table if exists t,s;
  6. Query OK, 0 rows affected (0.01 sec)
  7.  
  8. mysql> drop view if exists t,s;
  9. Query OK, 0 rows affected, 2 warnings (0.00 sec)
  10.  
  11. mysql> create table t (a int primary key) engine=innodb ;
  12. Query OK, 0 rows affected (0.01 sec)
  13.  
  14. mysql> insert into t values(1),(2),(3),(4);
  15. Query OK, 4 rows affected (0.00 sec)
  16. Records: 4 Duplicates: 0 Warnings: 0
  17.  
  18. mysql> analyze table t;
  19. +--------+---------+----------+----------+
  20. | Table | Op | Msg_type | Msg_text |
  21. +--------+---------+----------+----------+
  22. | test.t | analyze | status | OK |
  23. +--------+---------+----------+----------+
  24. 1 row in set (0.00 sec)
  25.  
  26. mysql>
  27. mysql> create table s(b int auto_increment primary key,c int,d int,key(c))engine=innodb;
  28. Query OK, 0 rows affected (0.01 sec)
  29.  
  30. mysql> insert into s(c) values(1),(2),(3),(4);
  31. Query OK, 4 rows affected (0.00 sec)
  32. Records: 4 Duplicates: 0 Warnings: 0
  33.  
  34. mysql> analyze table s;
  35. +--------+---------+----------+----------+
  36. | Table | Op | Msg_type | Msg_text |
  37. +--------+---------+----------+----------+
  38. | test.s | analyze | status | OK |
  39. +--------+---------+----------+----------+
  40. 1 row in set (0.00 sec)
  41.  
  42. mysql>
  43. mysql> select a,d from t left join s on c=a;
  44. +---+------+
  45. | a | d |
  46. +---+------+
  47. | 1 | NULL |
  48. | 2 | NULL |
  49. | 3 | NULL |
  50. | 4 | NULL |
  51. +---+------+
  52. 4 rows in set (0.00 sec)
  53.  
  54. mysql> select a,group_concat(d)q from t left join s on c=a;
  55. +---+------+
  56. | a | q |
  57. +---+------+
  58. | 1 | NULL |
  59. +---+------+
  60. 1 row in set (0.00 sec)
  61.  
  62. mysql> select a,group_concat(d)q from t left join s on c=a group by a;
  63. +---+------+
  64. | a | q |
  65. +---+------+
  66. | 1 | NULL |
  67. | 2 | NULL |
  68. | 3 | NULL |
  69. | 4 | NULL |
  70. +---+------+
  71. 4 rows in set (0.00 sec)
  72.  
  73. mysql>
  74. mysql> set sql_mode='only_full_group_by';
  75. Query OK, 0 rows affected (0.00 sec)
  76.  
  77. mysql>
  78. mysql> select a,d from t left join s on c=a;
  79. +---+------+
  80. | a | d |
  81. +---+------+
  82. | 1 | NULL |
  83. | 2 | NULL |
  84. | 3 | NULL |
  85. | 4 | NULL |
  86. +---+------+
  87. 4 rows in set (0.00 sec)
  88.  
  89. mysql> select a,group_concat(d)q from t left join s on c=a;
  90. ERROR 1140 (42000): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
  91. mysql> select a,group_concat(d)q from t left join s on c=a group by a;
  92. +---+------+
  93. | a | q |
  94. +---+------+
  95. | 1 | NULL |
  96. | 2 | NULL |
  97. | 3 | NULL |
  98. | 4 | NULL |
  99. +---+------+
  100. 4 rows in set (0.00 sec)
  101.  
  102. mysql>
  103. mysql> select version();
  104. +------------------+
  105. | version() |
  106. +------------------+
  107. | 5.0.96-community |
  108. +------------------+
  109. 1 row in set (0.00 sec)
  110.  
  111. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement