-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path10.sql
More file actions
24 lines (18 loc) · 835 Bytes
/
10.sql
File metadata and controls
24 lines (18 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- 10. Вывести все значения, которые есть в колонке одной таблицы и отсутствуют в колонке другой таблицы
create table T1 (
id int primary key,
name VARCHAR
);
create table T2 (
id int primary key,
name VARCHAR
);
insert into T1(id, name) values (1, 'Alexey');
insert into T1(id, name) values (2, 'Pavel');
insert into T1(id, name) values (3, 'Tikhon');
insert into T2(id, name) values (1, 'John');
insert into T2(id, name) values (2, 'Pavel');
insert into T2(id, name) values (3, 'Yury');
select * from T1 t1 left join T2 t2 on t1.name=t2.name;
select * from T1 t1 left join T2 t2 on t1.name=t2.name where t2.name is null;
select t1.name from T1 t1 left join T2 t2 on t1.name=t2.name where t2.name is null;