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

MySQL数据库

开发平台:

Visual C++

  1. drop table if exists t1,t2;
  2. CREATE TABLE t1 (
  3. Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
  4. Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
  5. ) ENGINE=blackhole;
  6. INSERT INTO t1 VALUES (9410,9412);
  7. select period from t1;
  8. period
  9. select * from t1;
  10. Period Varor_period
  11. select t1.* from t1;
  12. Period Varor_period
  13. CREATE TABLE t2 (
  14. auto int NOT NULL auto_increment,
  15. fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
  16. companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
  17. fld3 char(30) DEFAULT '' NOT NULL,
  18. fld4 char(35) DEFAULT '' NOT NULL,
  19. fld5 char(35) DEFAULT '' NOT NULL,
  20. fld6 char(4) DEFAULT '' NOT NULL,
  21. primary key (auto)
  22. ) ENGINE=blackhole;
  23. INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
  24. INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
  25. select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
  26. fld3
  27. select fld3 from t2 where fld3 like "%cultivation" ;
  28. fld3
  29. select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
  30. fld3 companynr
  31. select fld3,companynr from t2 where companynr = 58 order by fld3;
  32. fld3 companynr
  33. select fld3 from t2 order by fld3 desc limit 10;
  34. fld3
  35. select fld3 from t2 order by fld3 desc limit 5;
  36. fld3
  37. select fld3 from t2 order by fld3 desc limit 5,5;
  38. fld3
  39. select t2.fld3 from t2 where fld3 = 'honeysuckle';
  40. fld3
  41. select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
  42. fld3
  43. select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
  44. fld3
  45. select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
  46. fld3
  47. select t2.fld3 from t2 where fld3 LIKE 'h%le';
  48. fld3
  49. select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
  50. fld3
  51. select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
  52. fld3
  53. select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
  54. fld3
  55. select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
  56. fld1 fld3
  57. DROP TABLE t1;
  58. CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
  59. INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
  60. ('Full-text indexes', 'are called collections'),
  61. ('Only MyISAM tables','support collections'),
  62. ('Function MATCH ... AGAINST()','is used to do a search'),
  63. ('Full-text search in MySQL', 'implements vector space model');
  64. SHOW INDEX FROM t1;
  65. Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
  66. t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
  67. t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
  68. select * from t1 where MATCH(a,b) AGAINST ("collections");
  69. a b
  70. Only MyISAM tables support collections
  71. Full-text indexes are called collections
  72. explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
  73. id select_type table type possible_keys key key_len ref rows Extra
  74. 1 SIMPLE t1 fulltext a a 0 1 Using where
  75. Warnings:
  76. Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
  77. select * from t1 where MATCH(a,b) AGAINST ("indexes");
  78. a b
  79. Full-text indexes are called collections
  80. select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
  81. a b
  82. Full-text indexes are called collections
  83. Only MyISAM tables support collections
  84. select * from t1 where MATCH(a,b) AGAINST ("only");
  85. a b
  86. reset master;
  87. drop table t1,t2;
  88. create table t1 (a int) engine=blackhole;
  89. delete from t1 where a=10;
  90. update t1 set a=11 where a=15;
  91. insert into t1 values(1);
  92. insert ignore into t1 values(1);
  93. replace into t1 values(100);
  94. create table t2 (a varchar(200)) engine=blackhole;
  95. load data infile '../../std_data/words.dat' into table t2;
  96. alter table t1 add b int;
  97. alter table t1 drop b;
  98. create table t3 like t1;
  99. insert into t1 select * from t3;
  100. replace into t1 select * from t3;
  101. select * from t1;
  102. a
  103. select * from t2;
  104. a
  105. select * from t3;
  106. a
  107. show binlog events;
  108. Log_name Pos Event_type Server_id Orig_log_pos Info
  109. master-bin.000001 # Start 1 # Server ver: VERSION, Binlog ver: 3
  110. master-bin.000001 # Query 1 # use `test`; drop table t1,t2
  111. master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
  112. master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10
  113. master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15
  114. master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
  115. master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1)
  116. master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
  117. master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
  118. master-bin.000001 # Create_file 1 # db=test;table=t2;file_id=1;block_len=581
  119. master-bin.000001 # Exec_load 1 # ;file_id=1
  120. master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
  121. master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
  122. master-bin.000001 # Query 1 # use `test`; create table t3 like t1
  123. master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
  124. master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
  125. drop table t1,t2,t3;