PageRenderTime 62ms CodeModel.GetById 27ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/src/test/java/com/t11e/discovery/datatool/SqlChangesetExtractorTest.sql

http://github.com/t11e/discovery_datatool
SQL | 65 lines | 59 code | 6 blank | 0 comment | 0 complexity | 318971c7fd3bfe7f10ff8b0ceff3e578 MD5 | raw file
 1create table empty_table (
 2  id bigint generated by default as identity,
 3  last_updated timestamp
 4);
 5
 6create table date_range_test (
 7  id bigint generated by default as identity,
 8  last_updated timestamp
 9);
10insert into date_range_test (last_updated) values
11  ('2010-02-01-00.00.00.000000'),
12  ('2010-02-01-00.00.01.000000'),
13  ('2010-02-01-00.00.03.000000');
14
15create table string_column_test (
16  id bigint generated by default as identity,
17  col_fixed char(20),
18  col_string varchar(255),
19  col_clob clob
20);
21insert into string_column_test (col_fixed, col_string, col_clob) values
22  (NULL, NULL, NULL),
23  ('', '', ''),
24  ('a', 'b', 'c'),
25  (' a ', ' b ', ' c ');
26
27create table numeric_column_test (
28  id bigint generated by default as identity,
29  col_int int,
30  col_double double
31);
32insert into numeric_column_test (col_int, col_double) values
33  (NULL, NULL),
34  (0, 0),
35  (12, 34.56);
36
37create table datetime_column_test (
38  id bigint generated by default as identity,
39  col_date date,
40  col_time time,
41  col_datetime timestamp
42);
43insert into datetime_column_test (col_date, col_time, col_datetime) values
44  (NULL, NULL, NULL),
45  ('2010-01-01', '00:00:00', '2010-01-01 00:00:00');
46
47create table subquery_test (
48  id bigint primary key generated by default as identity
49);
50create table subquery_joined_test (
51  id bigint generated by default as identity,
52  parent_id bigint not null,
53  name varchar(255)
54);
55alter table subquery_joined_test add foreign key (parent_id) references subquery_test(id);
56
57insert into subquery_test (id) values
58  (1),
59  (2),
60  (3);
61insert into subquery_joined_test (parent_id, name) values
62  (1, 'redfish'),
63  (1, 'bluefish'),
64  (3, 'onefish'),
65  (3, 'twofish');