mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add the ability to group FROM terms using parentheses. Names of columns in
a join no longer include the table name. (CVS 1197) FossilOrigin-Name: 3626f6d4a1adb4209d5bd9e6477343b52bddbdf2
This commit is contained in:
73
test/join2.test
Normal file
73
test/join2.test
Normal file
@ -0,0 +1,73 @@
|
||||
# 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: join2.test,v 1.1 2004/01/24 20:18:13 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test join2-1.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b);
|
||||
INSERT INTO t1 VALUES(1,11);
|
||||
INSERT INTO t1 VALUES(2,22);
|
||||
INSERT INTO t1 VALUES(3,33);
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 11 2 22 3 33}
|
||||
do_test join2-1.2 {
|
||||
execsql {
|
||||
CREATE TABLE t2(b,c);
|
||||
INSERT INTO t2 VALUES(11,111);
|
||||
INSERT INTO t2 VALUES(33,333);
|
||||
INSERT INTO t2 VALUES(44,444);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {11 111 33 333 44 444};
|
||||
do_test join2-1.3 {
|
||||
execsql {
|
||||
CREATE TABLE t3(c,d);
|
||||
INSERT INTO t3 VALUES(111,1111);
|
||||
INSERT INTO t3 VALUES(444,4444);
|
||||
INSERT INTO t3 VALUES(555,5555);
|
||||
SELECT * FROM t3;
|
||||
}
|
||||
} {111 1111 444 4444 555 5555}
|
||||
|
||||
do_test join2-1.4 {
|
||||
execsql {
|
||||
SELECT * FROM
|
||||
t1 NATURAL JOIN t2 NATURAL JOIN t3
|
||||
}
|
||||
} {1 11 111 1111}
|
||||
do_test join2-1.5 {
|
||||
execsql {
|
||||
SELECT * FROM
|
||||
t1 NATURAL JOIN t2 NATURAL LEFT OUTER JOIN t3
|
||||
}
|
||||
} {1 11 111 1111 3 33 333 {}}
|
||||
do_test join2-1.6 {
|
||||
execsql {
|
||||
SELECT * FROM
|
||||
t1 NATURAL LEFT OUTER JOIN t2 NATURAL JOIN t3
|
||||
}
|
||||
} {1 11 111 1111}
|
||||
do_test join2-1.6 {
|
||||
execsql {
|
||||
SELECT * FROM
|
||||
t1 NATURAL LEFT OUTER JOIN (t2 NATURAL JOIN t3)
|
||||
}
|
||||
} {1 11 111 1111 2 22 {} {} 3 33 {} {}}
|
||||
|
||||
finish_test
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing SELECT statements that contain
|
||||
# subqueries in their FROM clause.
|
||||
#
|
||||
# $Id: select6.test,v 1.10 2003/05/02 16:44:25 drh Exp $
|
||||
# $Id: select6.test,v 1.11 2004/01/24 20:18:13 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -163,7 +163,7 @@ do_test sqlite6-3.2 {
|
||||
FROM (SELECT count(*) as p , b as q FROM t2 GROUP BY q) AS a,
|
||||
(SELECT max(a) as r, b as s FROM t2 GROUP BY s) as b
|
||||
WHERE a.q=b.s ORDER BY a.q)
|
||||
ORDER BY [a.q]
|
||||
ORDER BY q
|
||||
}
|
||||
} {1 1 1 2 2 3 3 4 7 4 8 15 5 5 20}
|
||||
do_test select6-3.3 {
|
||||
|
Reference in New Issue
Block a user