-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sql
35 lines (35 loc) · 2.67 KB
/
test.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
create table mySets (id integer primary key, iset intSet);
--insert into mySets values (1, '{1,2,3}');
--insert into mySets values (2, '{1,2,3}');
--insert into mySets values (3, '{1,4,5}');
--insert into mySets values (4, '{2,2,2,3,5,5,7}');
--insert into mySets values (5, '{1,2,3,31,32}');
--insert into mySets values (6, '{4,5,31,32}');
insert into mySets values (1, '{1,2,3}');
insert into mySets values (2, '{1,3,1,3,1}');
insert into mySets values (3, '{3,4,5}');
insert into mySets values (4, '{4,5}');
insert into mySets values (5, '{1,2,3}');
--insert into mySets values (2, '{3, 5, 10, 21, 36, 60, 80, 120, 180, 264, 252, 360, 300, 960, 900, 720, 1080, 1440, 1800, 1680, 2160, 2880, 5616, 3780, 2520, 3600, 6120, 6720, 6300, 5040, 11340, 7560, 14112, 10800, 9240, 10080, 13860, 12600, 31200, 15120, 22680, 20160, 18480, 39312, 33264, 39600, 25200, 30240}');
--insert into mySets values (3, '{1, 2, 4, 0, 6, 0, 0, 2, 8, 2, 0, 4, 0, 0, 4, 0, 10, 0, 4, 0, 0, 0, 8, 4, 0, 2, 0, 0, 6, 4, 0, 0, 12, 0, 0, 0, 6, 4, 0, 0, 0, 0, 0, 4, 12, 0, 8, 0, 0, 2, 4, 0, 0, 4, 0, 0, 8, 0, 8, 0, 0, 0, 0, 2, 14, 0, 0, 4, 0, 0, 0, 4, 8, 0, 8, 0, 0, 4, 0, 4, 0, 2, 0, 0, 0, 0, 8, 0, 16, 0, 0, 0, 12, 0, 0, 0, 0, 0, 4, 4, 6, 0}');
--insert into mySets values (4, '{{4,5}}}');
--insert into mySets values (5, '{01,001,0001,00001}');
--insert into mySets values (6, '{1,2,3,a,b,c}');
--insert into mySets values (7, '{1,2,3,3.14}');
--insert into mySets values (8, '{-1, -2}');
--insert into mySets values (9, '{-3, -3.14}');
--insert into mySets values (10, '{1,,2,3}');
--insert into mySets values (11, '{}');
--insert into mySets values (12, '{ }');
select * from mySets order by id;
select a.*, b.* from mySets a, mySets b where (b.iset @< a.iset) and a.id != b.id;
update mySets set iset = iset || '{5,6,7,8}' where id = 4;
select * from mySets where id=4;
select id, iset, (#iset) as card from mySets order by id;
select a.id, a.iset, b.id, b.iset, (a.iset = b.iset) as equal_set from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset <> b.iset) as not_equal_set from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset - b.iset) as difference from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset && b.iset) as A_intersection_B from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset || b.iset) as A_union_B from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset !! b.iset) as A_disjunction_B from mySets a, mySets b where a.id < b.id;
select a.id, a.iset, b.id, b.iset, (a.iset !! b.iset) as A_disjunction_B from mySets a, mySets b where a.id < b.id;