Initial implementation of LEFT OUTER JOIN including the expanded SQL92 join
syntax. The basic functionality is there but there is still a lot of testing to do. (CVS 587) FossilOrigin-Name: 99bd1f5b9a1a20bfeefe15c00d96a34a5f40923e
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
# 2002 May 24
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# This file implements tests for joins, including outer joins.
|
||||
#
|
||||
# $Id: join.test,v 1.1 2002/05/24 20:31:38 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test join-1.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b,c);
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
INSERT INTO t1 VALUES(2,3,4);
|
||||
INSERT INTO t1 VALUES(3,4,5);
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2 3 2 3 4 3 4 5}
|
||||
do_test join-1.2 {
|
||||
execsql {
|
||||
CREATE TABLE t2(b,c,d);
|
||||
INSERT INTO t2 VALUES(1,2,3);
|
||||
INSERT INTO t2 VALUES(2,3,4);
|
||||
INSERT INTO t2 VALUES(3,4,5);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 2 3 2 3 4 3 4 5}
|
||||
|
||||
do_test join-1.3 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 NATURAL JOIN t2;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
do_test join-1.4 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b,c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
do_test join-1.5 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.c 4 t2.d 5}
|
||||
do_test join-1.6 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.b 2 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.b 3 t2.d 5}
|
||||
do_test join-1.7 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c,b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
|
||||
do_test join-2.1 {
|
||||
execsql {
|
||||
SELECT * FROM t1 NATURAL LEFT JOIN t2;
|
||||
}
|
||||
} {1 2 3 4 2 3 4 5 3 4 5 {}}
|
||||
|
||||
finish_test
|
||||
Reference in New Issue
Block a user