Files
oceanbase/tools/deploy/mysql_test/r/mysql/join_null.result
2023-11-15 11:44:44 +00:00

31 lines
765 B
Plaintext

drop table if exists t1,t2,t5,t6;
CREATE TABLE t1 (
pk int primary key,
id int,
gender varchar(1)
);
CREATE TABLE t2 (
user_id int primary key,
birthday datetime
);
insert into t1 values (1, NULL, 'M'), (2, 1, 'M'), (3, 2, 'F'),(4, 3, 'F'),(5, 4, 'F'),(6, 5, 'M');
insert into t2 values (1, '2002-06-09 00:00:00'),(2, '2002-06-09 00:00:00'),(100, '2002-06-09 00:00:00'),
(3, '2002-06-09 00:00:00'),(4, '2002-06-09 00:00:00');
select id,gender,user_id from t1,t2 where t2.user_id=t1.id;
id gender user_id
1 M 1
2 F 2
3 F 3
4 F 4
create table t5(a int);
create table t6(a int);
insert into t5 values (null), (null);
insert into t6 values (null), (null);
select * from t5, t6 where t5.a <=> t6.a;
a a
NULL NULL
NULL NULL
NULL NULL
NULL NULL
drop table t1,t2,t5,t6;