-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(mtr):add delete_join.test and modified issue515.test(#497)
- Loading branch information
1 parent
30b7fc1
commit 35e7800
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# DELETE JOIN | ||
# | ||
DROP DATABASE IF EXISTS delete_join_test; | ||
CREATE DATABASE delete_join_test; | ||
USE delete_join_test; | ||
CREATE TABLE t1 (t1_int INT, t1_char CHAR(5)); | ||
CREATE TABLE t2 (t2_int INT, t2_char CHAR(5)); | ||
INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); | ||
INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); | ||
SELECT * FROM t1 ORDER BY t1_int; | ||
t1_int t1_char | ||
NULL | ||
1 aaa | ||
2 bbb | ||
3 ccc | ||
4 ddd | ||
5 aa | ||
6 | ||
7 aaaaa | ||
SELECT * FROM t2 ORDER BY t2_int; | ||
t2_int t2_char | ||
NULL | ||
1 hhhh | ||
3 iii | ||
5 jjj | ||
6 | ||
7 lll | ||
9 m | ||
11 nnn | ||
DELETE t1 FROM t1 INNER JOIN t2 ON t1.t1_int=t2.t2_int AND t1.t1_char LIKE '%a%'; | ||
SELECT * FROM t1 ORDER BY t1_int; | ||
t1_int t1_char | ||
NULL | ||
2 bbb | ||
3 ccc | ||
4 ddd | ||
6 | ||
DELETE t2 FROM t2 LEFT JOIN t1 ON t1.t1_int=t2.t2_int WHERE t2.t2_int IS NULL; | ||
SELECT * FROM t2 ORDER BY t2_int; | ||
t2_int t2_char | ||
1 hhhh | ||
3 iii | ||
5 jjj | ||
6 | ||
7 lll | ||
9 m | ||
11 nnn | ||
DROP DATABASE delete_join_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--echo # | ||
--echo # DELETE JOIN | ||
--echo # | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS delete_join_test; | ||
--enable_warnings | ||
|
||
CREATE DATABASE delete_join_test; | ||
USE delete_join_test; | ||
|
||
CREATE TABLE t1 (t1_int INT, t1_char CHAR(5)); | ||
CREATE TABLE t2 (t2_int INT, t2_char CHAR(5)); | ||
INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); | ||
INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); | ||
|
||
SELECT * FROM t1 ORDER BY t1_int; | ||
SELECT * FROM t2 ORDER BY t2_int; | ||
|
||
DELETE t1 FROM t1 INNER JOIN t2 ON t1.t1_int=t2.t2_int AND t1.t1_char LIKE '%a%'; | ||
SELECT * FROM t1 ORDER BY t1_int; | ||
DELETE t2 FROM t2 LEFT JOIN t1 ON t1.t1_int=t2.t2_int WHERE t2.t2_int IS NULL; | ||
SELECT * FROM t2 ORDER BY t2_int; | ||
|
||
# Clean UP | ||
DROP DATABASE delete_join_test; |
File renamed without changes.