~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/join.result

Merge Joe, plus I updated the tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
INSERT INTO t1 VALUES (1);
5
5
INSERT INTO t2 VALUES (2);
6
6
SELECT * FROM t1 JOIN t2;
7
 
ERROR HY000: Implicit cartesian join attempted.
 
7
S1      S1
 
8
1       2
8
9
SELECT * FROM t1 INNER JOIN t2;
9
 
ERROR HY000: Implicit cartesian join attempted.
 
10
S1      S1
 
11
1       2
10
12
SELECT * from t1 JOIN t2 USING (S1);
11
13
S1
12
14
SELECT * FROM t1 INNER JOIN t2 USING (S1);
72
74
count int DEFAULT '0' NOT NULL,
73
75
qty int,
74
76
phone char(1) DEFAULT '' NOT NULL,
75
 
timestamp_arg datetime,
 
77
timestamp datetime,
76
78
PRIMARY KEY (id),
77
79
KEY token (token(15)),
78
 
KEY timestamp_arg (timestamp_arg),
 
80
KEY timestamp (timestamp),
79
81
UNIQUE token_2 (token(75),count,phone)
80
82
);
81
83
INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21');
160
162
d
161
163
NULL
162
164
SELECT * FROM t1 WHERE 1/0 IS NULL;
163
 
ERROR 22012: Division by 0
 
165
d
 
166
2001-08-01
 
167
NULL
 
168
Warnings:
 
169
Error   1365    Division by 0
 
170
Error   1365    Division by 0
 
171
Error   1365    Division by 0
164
172
DROP TABLE t1,t2;
165
173
CREATE TABLE t1 (
166
174
Document_ID varchar(50) NOT NULL default '',
297
305
CREATE TABLE t2 (b int);
298
306
CREATE TABLE t3 (c int);
299
307
SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
300
 
ERROR HY000: Implicit cartesian join attempted.
 
308
a       b       c
301
309
DROP TABLE t1, t2, t3;
302
310
create table t1 (i int);
303
311
create table t2 (i int);
591
599
3       1       2       2
592
600
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
593
601
c       b       a       b       b       c       y       c
 
602
10      1       2       1       1       3       11      3
594
603
10      1       2       1       1       10      11      3
595
 
10      1       2       1       1       3       11      3
 
604
3       1       2       1       1       3       11      3
596
605
3       1       2       1       1       10      11      3
597
 
3       1       2       1       1       3       11      3
 
606
3       2       2       1       1       3       11      3
598
607
3       2       2       1       1       10      11      3
599
 
3       2       2       1       1       3       11      3
600
608
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
601
609
c       b       a       b       b       c       y       c
 
610
10      1       2       1       1       3       11      3
602
611
10      1       2       1       1       10      11      3
603
 
10      1       2       1       1       3       11      3
 
612
3       1       2       1       1       3       11      3
604
613
3       1       2       1       1       10      11      3
605
 
3       1       2       1       1       3       11      3
 
614
3       2       2       1       1       3       11      3
606
615
3       2       2       1       1       10      11      3
607
 
3       2       2       1       1       3       11      3
608
616
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
609
617
b       c       a       c       b       y
610
618
1       10      2       3       1       2
611
619
1       3       2       3       1       2
612
620
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
613
621
b       c       c       b       a       b       y       c       y       z
 
622
1       3       10      1       2       1       11      3       11      4
614
623
1       10      10      1       2       1       11      3       11      4
 
624
1       3       3       1       2       1       11      3       11      4
615
625
1       10      3       1       2       1       11      3       11      4
616
 
1       3       10      1       2       1       11      3       11      4
617
 
1       3       3       1       2       1       11      3       11      4
618
626
select * from t1 natural join t2 where t1.b > 0;
619
627
b       c       a
620
628
1       10      2
772
780
create table t2 (a int, b int, filler char(100), key(a), key(b));
773
781
create table t3 (a int, b int, filler char(100), key(a), key(b));
774
782
insert into t2 
775
 
select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C where B.a >= 0;
 
783
select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
776
784
insert into t3 select * from t2 where a < 800;
777
785
drop table t1, t2, t3;
778
786
create table t1 (a int);
779
787
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
780
788
create table t2 (a int, b int, primary key(a));
781
 
insert into t2 select @v:=A.a+10*B.a, @v  from t1 A, t1 B where B.a >= 0;
 
789
insert into t2 select @v:=A.a+10*B.a, @v  from t1 A, t1 B;
782
790
explain select * from t1;
783
791
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
784
792
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    10