github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/kafka_simple_basic_avro/data/data.sql (about) 1 drop database if exists test; 2 create database test; 3 use test; 4 5 create table tp_int 6 ( 7 id int auto_increment, 8 c_tinyint tinyint null, 9 c_smallint smallint null, 10 c_mediumint mediumint null, 11 c_int int null, 12 c_bigint bigint null, 13 constraint pk 14 primary key (id) 15 ); 16 17 insert into tp_int() 18 values (); 19 20 insert into tp_int(c_tinyint, c_smallint, c_mediumint, c_int, c_bigint) 21 values (1, 2, 3, 4, 5); 22 23 -- insert max value 24 insert into tp_int(c_tinyint, c_smallint, c_mediumint, c_int, c_bigint) 25 values (127, 32767, 8388607, 2147483647, 9223372036854775807); 26 27 -- insert min value 28 insert into tp_int(c_tinyint, c_smallint, c_mediumint, c_int, c_bigint) 29 values (-128, -32768, -8388608, -2147483648, -9223372036854775808); 30 31 update tp_int set c_int = 0, c_tinyint = 0 where c_smallint = 2; 32 delete from tp_int where c_int = 0; 33 34 -- unsigned int 35 create table tp_unsigned_int ( 36 id int auto_increment, 37 c_unsigned_tinyint tinyint unsigned null, 38 c_unsigned_smallint smallint unsigned null, 39 c_unsigned_mediumint mediumint unsigned null, 40 c_unsigned_int int unsigned null, 41 c_unsigned_bigint bigint unsigned null, 42 constraint pk 43 primary key (id) 44 ); 45 46 insert into tp_unsigned_int() 47 values (); 48 49 insert into tp_unsigned_int(c_unsigned_tinyint, c_unsigned_smallint, c_unsigned_mediumint, 50 c_unsigned_int, c_unsigned_bigint) 51 values (1, 2, 3, 4, 5); 52 53 -- insert max value 54 insert into tp_unsigned_int(c_unsigned_tinyint, c_unsigned_smallint, c_unsigned_mediumint, 55 c_unsigned_int, c_unsigned_bigint) 56 values (255, 65535, 16777215, 4294967295, 18446744073709551615); 57 58 -- insert signed max value 59 insert into tp_unsigned_int(c_unsigned_tinyint, c_unsigned_smallint, c_unsigned_mediumint, 60 c_unsigned_int, c_unsigned_bigint) 61 values (127, 32767, 8388607, 2147483647, 9223372036854775807); 62 63 insert into tp_unsigned_int(c_unsigned_tinyint, c_unsigned_smallint, c_unsigned_mediumint, 64 c_unsigned_int, c_unsigned_bigint) 65 values (128, 32768, 8388608, 2147483648, 9223372036854775808); 66 67 update tp_unsigned_int set c_unsigned_int = 0, c_unsigned_tinyint = 0 where c_unsigned_smallint = 65535; 68 delete from tp_unsigned_int where c_unsigned_int = 0; 69 70 -- real 71 create table tp_real 72 ( 73 id int auto_increment, 74 c_float float null, 75 c_double double null, 76 c_decimal decimal null, 77 c_decimal_2 decimal(10, 4) null, 78 constraint pk 79 primary key (id) 80 ); 81 82 insert into tp_real() 83 values (); 84 85 insert into tp_real(c_float, c_double, c_decimal, c_decimal_2) 86 values (2020.0202, 2020.0303, 2020.0404, 2021.1208); 87 88 insert into tp_real(c_float, c_double, c_decimal, c_decimal_2) 89 values (-2.7182818284, -3.1415926, -8000, -179394.233); 90 91 update tp_real set c_double = 2.333 where c_double = 2020.0303; 92 93 -- unsigned real 94 create table tp_unsigned_real ( 95 id int auto_increment, 96 c_unsigned_float float unsigned null, 97 c_unsigned_double double unsigned null, 98 c_unsigned_decimal decimal unsigned null, 99 c_unsigned_decimal_2 decimal(10, 4) unsigned null, 100 constraint pk 101 primary key (id) 102 ); 103 104 insert into tp_unsigned_real() 105 values (); 106 107 insert into tp_unsigned_real(c_unsigned_float, c_unsigned_double, c_unsigned_decimal, c_unsigned_decimal_2) 108 values (2020.0202, 2020.0303, 2020.0404, 2021.1208); 109 110 update tp_unsigned_real set c_unsigned_double = 2020.0404 where c_unsigned_double = 2020.0303; 111 112 -- time 113 create table tp_time 114 ( 115 id int auto_increment, 116 c_date date null, 117 c_datetime datetime null, 118 c_timestamp timestamp null, 119 c_time time null, 120 c_year year null, 121 constraint pk 122 primary key (id) 123 ); 124 125 insert into tp_time() 126 values (); 127 128 insert into tp_time(c_date, c_datetime, c_timestamp, c_time, c_year) 129 values ('2020-02-20', '2020-02-20 02:20:20', '2020-02-20 02:20:20', '02:20:20', '2020'); 130 131 insert into tp_time(c_date, c_datetime, c_timestamp, c_time, c_year) 132 values ('2022-02-22', '2022-02-22 22:22:22', '2020-02-20 02:20:20', '02:20:20', '2021'); 133 134 update tp_time set c_year = '2022' where c_year = '2020'; 135 update tp_time set c_date = '2022-02-22' where c_datetime = '2020-02-20 02:20:20'; 136 137 -- text 138 create table tp_text 139 ( 140 id int auto_increment, 141 c_tinytext tinytext null, 142 c_text text null, 143 c_mediumtext mediumtext null, 144 c_longtext longtext null, 145 constraint pk 146 primary key (id) 147 ); 148 149 insert into tp_text() 150 values (); 151 152 insert into tp_text(c_tinytext, c_text, c_mediumtext, c_longtext) 153 values ('89504E470D0A1A0A', '89504E470D0A1A0A', '89504E470D0A1A0A', '89504E470D0A1A0A'); 154 155 insert into tp_text(c_tinytext, c_text, c_mediumtext, c_longtext) 156 values ('89504E470D0A1A0B', '89504E470D0A1A0B', '89504E470D0A1A0B', '89504E470D0A1A0B'); 157 158 update tp_text set c_text = '89504E470D0A1A0B' where c_mediumtext = '89504E470D0A1A0A'; 159 160 -- blob 161 create table tp_blob 162 ( 163 id int auto_increment, 164 c_tinyblob tinyblob null, 165 c_blob blob null, 166 c_mediumblob mediumblob null, 167 c_longblob longblob null, 168 constraint pk 169 primary key (id) 170 ); 171 172 insert into tp_blob() 173 values (); 174 175 insert into tp_blob(c_tinyblob, c_blob, c_mediumblob, c_longblob) 176 values (x'89504E470D0A1A0A', x'89504E470D0A1A0A', x'89504E470D0A1A0A', x'89504E470D0A1A0A'); 177 178 insert into tp_blob(c_tinyblob, c_blob, c_mediumblob, c_longblob) 179 values (x'89504E470D0A1A0B', x'89504E470D0A1A0B', x'89504E470D0A1A0B', x'89504E470D0A1A0B'); 180 181 update tp_blob set c_blob = x'89504E470D0A1A0B' where c_mediumblob = x'89504E470D0A1A0A'; 182 183 -- char / binary 184 create table tp_char_binary 185 ( 186 id int auto_increment, 187 c_char char(16) null, 188 c_varchar varchar(16) null, 189 c_binary binary(16) null, 190 c_varbinary varbinary(16) null, 191 constraint pk 192 primary key (id) 193 ); 194 195 insert into tp_char_binary() 196 values (); 197 198 insert into tp_char_binary(c_char, c_varchar, c_binary, c_varbinary) 199 values ('89504E470D0A1A0A', '89504E470D0A1A0A', x'89504E470D0A1A0A', x'89504E470D0A1A0A'); 200 201 insert into tp_char_binary(c_char, c_varchar, c_binary, c_varbinary) 202 values ('89504E470D0A1A0B', '89504E470D0A1A0B', x'89504E470D0A1A0B', x'89504E470D0A1A0B'); 203 204 update tp_char_binary set c_varchar = '89504E470D0A1A0B' where c_binary = x'89504E470D0A1A0A'; 205 206 -- other 207 create table tp_other 208 ( 209 id int auto_increment, 210 c_enum enum ('a','b','c') null, 211 c_set set ('a','b','c') null, 212 c_bit bit(64) null, 213 c_json json null, 214 constraint pk 215 primary key (id) 216 ); 217 218 insert into tp_other() 219 values (); 220 221 insert into tp_other(c_enum, c_set, c_bit, c_json) 222 values ('a', 'a,b', b'1000001', '{ 223 "key1": "value1", 224 "key2": "value2" 225 }'); 226 227 insert into tp_other(c_enum, c_set, c_bit, c_json) 228 values ('b', 'b,c', b'1000001', '{ 229 "key1": "value1", 230 "key2": "value2", 231 "key3": "123" 232 }'); 233 234 update tp_other set c_enum = 'c' where c_set = 'b,c'; 235 236 -- gbk dmls 237 CREATE TABLE cs_gbk ( 238 id INT, 239 name varchar(128) CHARACTER SET gbk, 240 country char(32) CHARACTER SET gbk, 241 city varchar(64), 242 description text CHARACTER SET gbk, 243 image tinyblob, 244 PRIMARY KEY (id) 245 ) ENGINE = InnoDB CHARSET = utf8mb4; 246 247 INSERT INTO cs_gbk 248 VALUES (1, '测试', "中国", "上海", "你好,世界" 249 , 0xC4E3BAC3CAC0BDE7); 250 251 INSERT INTO cs_gbk 252 VALUES (2, '部署', "美国", "纽约", "世界,你好" 253 , 0xCAC0BDE7C4E3BAC3); 254 255 UPDATE cs_gbk 256 SET name = '开发' 257 WHERE name = '测试'; 258 259 DELETE FROM cs_gbk 260 WHERE name = '部署' 261 AND country = '美国' 262 AND city = '纽约' 263 AND description = '世界,你好'; 264 265 -- ddls 266 CREATE TABLE test_ddl1 267 ( 268 id INT AUTO_INCREMENT, 269 c1 INT, 270 PRIMARY KEY (id) 271 ); 272 273 CREATE TABLE test_ddl2 274 ( 275 id INT AUTO_INCREMENT, 276 c1 INT, 277 PRIMARY KEY (id) 278 ); 279 280 RENAME TABLE test_ddl1 TO test_ddl; 281 282 ALTER TABLE test_ddl 283 ADD INDEX test_add_index (c1); 284 285 DROP INDEX test_add_index ON test_ddl; 286 287 ALTER TABLE test_ddl 288 ADD COLUMN c2 INT NOT NULL; 289 290 TRUNCATE TABLE test_ddl; 291 292 DROP TABLE test_ddl2; 293 294 CREATE TABLE test_ddl2 295 ( 296 id INT AUTO_INCREMENT, 297 c1 INT, 298 PRIMARY KEY (id) 299 ); 300 301 CREATE TABLE test_ddl3 ( 302 id INT, 303 名称 varchar(128), 304 PRIMARY KEY (id) 305 ) ENGINE = InnoDB; 306 307 ALTER TABLE test_ddl3 308 ADD COLUMN 城市 char(32); 309 310 ALTER TABLE test_ddl3 311 MODIFY COLUMN 城市 varchar(32); 312 313 ALTER TABLE test_ddl3 314 DROP COLUMN 城市; 315 316 /* this is a DDL test for table */ 317 CREATE TABLE 表1 ( 318 id INT, 319 name varchar(128), 320 PRIMARY KEY (id) 321 ) ENGINE = InnoDB; 322 323 RENAME TABLE 表1 TO 表2; 324 325 DROP TABLE 表2; 326 327 create table finish_mark 328 ( 329 id int PRIMARY KEY 330 );