github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/kafka_simple_basic/data/data.sql (about)

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