endspace.result
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:6k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. drop table if exists t1;
  2. select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
  3. 'a' = 'a' 'a' = 'a ' 'a ' = 'a'
  4. 1 1 1
  5. select 'a' = 'a', 'a' < 'a', 'a' > 'a';
  6. 'a' = 'a' 'a' < 'a' 'a' > 'a'
  7. 0 1 0
  8. select 'a' = 'a', 'a' < 'a', 'a' > 'a';
  9. 'a' = 'a' 'a' < 'a' 'a' > 'a'
  10. 0 0 1
  11. select 'a' = 'a ', 'a' < 'a ', 'a' > 'a ';
  12. 'a' = 'a ' 'a' < 'a ' 'a' > 'a '
  13. 0 1 0
  14. select 'a ' = 'a', 'a ' < 'a', 'a ' > 'a';
  15. 'a ' = 'a' 'a ' < 'a' 'a ' > 'a'
  16. 0 0 1
  17. select 'a  a' > 'a', 'a  ' < 'a';
  18. 'a  a' > 'a' 'a  ' < 'a'
  19. 1 1
  20. select binary 'a  a' > 'a', binary 'a  ' > 'a', binary 'a' > 'a';
  21. binary 'a  a' > 'a' binary 'a  ' > 'a' binary 'a' > 'a'
  22. 1 1 1
  23. create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
  24. insert into t1 values ('teststring'), ('nothing'), ('teststringt');
  25. check table t1;
  26. Table Op Msg_type Msg_text
  27. test.t1 check status OK
  28. select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
  29. text1
  30. teststring
  31. teststring
  32. select * from t1 where text1='teststring' or text1 like 'teststring_%';
  33. text1
  34. teststring
  35. teststring
  36. select * from t1 where text1='teststring' or text1 > 'teststringt';
  37. text1
  38. teststring
  39. select * from t1 order by text1;
  40. text1
  41. nothing
  42. teststring
  43. teststring
  44. explain select * from t1 order by text1;
  45. id select_type table type possible_keys key key_len ref rows Extra
  46. 1 SIMPLE t1 index NULL key1 32 NULL 3 Using index
  47. alter table t1 modify text1 char(32) binary not null;
  48. check table t1;
  49. Table Op Msg_type Msg_text
  50. test.t1 check status OK
  51. select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
  52. text1
  53. teststring
  54. teststring
  55. select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
  56. concat('|', text1, '|')
  57. |teststring |
  58. |teststring|
  59. select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststringt';
  60. concat('|', text1, '|')
  61. |teststring|
  62. select text1, length(text1) from t1 order by text1;
  63. text1 length(text1)
  64. nothing 7
  65. teststring 11
  66. teststring 10
  67. select text1, length(text1) from t1 order by binary text1;
  68. text1 length(text1)
  69. nothing 7
  70. teststring 10
  71. teststring 11
  72. alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
  73. insert into t1 values ('teststring ');
  74. select concat('|', text1, '|') from t1 order by text1;
  75. concat('|', text1, '|')
  76. |nothing|
  77. |teststring|
  78. |teststring |
  79. |teststring |
  80. select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststringt';
  81. concat('|', text1, '|')
  82. |teststring|
  83. |teststring |
  84. select concat('|', text1, '|') from t1 where text1='teststring';
  85. concat('|', text1, '|')
  86. |teststring|
  87. select concat('|', text1, '|') from t1 where text1='teststring ';
  88. concat('|', text1, '|')
  89. |teststring |
  90. alter table t1 modify text1 text not null, pack_keys=1;
  91. select concat('|', text1, '|') from t1 where text1='teststring';
  92. concat('|', text1, '|')
  93. |teststring|
  94. |teststring |
  95. select concat('|', text1, '|') from t1 where text1='teststring ';
  96. concat('|', text1, '|')
  97. |teststring|
  98. |teststring |
  99. explain select concat('|', text1, '|') from t1 where text1='teststring ';
  100. id select_type table type possible_keys key key_len ref rows Extra
  101. 1 SIMPLE t1 range key1 key1 22 NULL 2 Using where
  102. select * from t1 where text1 like 'teststring_%';
  103. text1
  104. teststring
  105. teststring 
  106. select * from t1 where text1='teststring' or text1 like 'teststring_%';
  107. text1
  108. teststring
  109. teststring
  110. teststring 
  111. select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststringt';
  112. concat('|', text1, '|')
  113. |teststring|
  114. |teststring |
  115. select concat('|', text1, '|') from t1 order by text1;
  116. concat('|', text1, '|')
  117. |nothing|
  118. |teststring |
  119. |teststring|
  120. |teststring |
  121. drop table t1;
  122. create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
  123. insert into t1 values ('teststring'), ('nothing'), ('teststringt');
  124. select * from t1 where text1='teststring' or text1 like 'teststring_%';
  125. text1
  126. teststring
  127. teststring
  128. select * from t1 where text1='teststring' or text1 >= 'teststringt';
  129. text1
  130. teststring
  131. teststring
  132. drop table t1;
  133. create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
  134. insert into t1 values ('teststring'), ('nothing'), ('teststringt');
  135. select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
  136. text1
  137. teststring
  138. teststring
  139. select * from t1 where text1='teststring' or text1 like 'teststring_%';
  140. text1
  141. teststring
  142. teststring
  143. select * from t1 where text1='teststring' or text1 >= 'teststringt';
  144. text1
  145. teststring
  146. teststring
  147. select * from t1 order by text1;
  148. text1
  149. nothing
  150. teststring
  151. teststring
  152. explain select * from t1 order by text1;
  153. id select_type table type possible_keys key key_len ref rows Extra
  154. 1 SIMPLE t1 index NULL key1 32 NULL 3
  155. alter table t1 modify text1 char(32) binary not null;
  156. select * from t1 order by text1;
  157. text1
  158. nothing
  159. teststring
  160. teststring
  161. drop table t1;
  162. create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
  163. insert into t1 values ('teststring'), ('nothing'), ('teststringt');
  164. check table t1;
  165. Table Op Msg_type Msg_text
  166. test.t1 check status OK
  167. select * from t1 where text1='teststring' or text1 like 'teststring_%';
  168. text1
  169. teststring
  170. teststring
  171. select * from t1 where text1='teststring' or text1 > 'teststringt';
  172. text1
  173. teststring
  174. select * from t1 order by text1;
  175. text1
  176. nothing
  177. teststring
  178. teststring
  179. explain select * from t1 order by text1;
  180. id select_type table type possible_keys key key_len ref rows Extra
  181. 1 SIMPLE t1 index NULL key1 32 NULL 3 Using index
  182. alter table t1 modify text1 char(32) binary not null;
  183. select * from t1 order by text1;
  184. text1
  185. nothing
  186. teststring
  187. teststring
  188. alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
  189. insert into t1 values ('teststring ');
  190. select concat('|', text1, '|') from t1 order by text1;
  191. concat('|', text1, '|')
  192. |nothing|
  193. |teststring|
  194. |teststring |
  195. |teststring |
  196. alter table t1 modify text1 text not null, pack_keys=1;
  197. select * from t1 where text1 like 'teststring_%';
  198. text1
  199. teststring
  200. teststring 
  201. select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
  202. text1 length(text1)
  203. teststring 10
  204. teststring 11
  205. teststring  11
  206. select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststringt';
  207. text1 length(text1)
  208. teststring 10
  209. teststring 11
  210. teststring  11
  211. select concat('|', text1, '|') from t1 order by text1;
  212. concat('|', text1, '|')
  213. |nothing|
  214. |teststring |
  215. |teststring|
  216. |teststring |
  217. drop table t1;