-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter5.sql
More file actions
73 lines (61 loc) · 1.07 KB
/
Copy pathChapter5.sql
File metadata and controls
73 lines (61 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
SELECT *
from artist as art
inner join album as alb
on art.artist_id = alb.artist_id;
SELECT *
from artist as art
inner join album as alb
using (artist_id);
SELECT
alb1.artist_id,
alb1.title as alb1_title,
alb2.title as alb2_title
from album as alb1
INNER join album as alb2
on art1.artist_id = art2.artist_id
where alb1.album_id <>alb2.album_id;
select *
from artist as art
left join album as alb
on art.artist_id = alb.artist_id;
SELECT *
from artist as art
right join album as alb
on art.artist_id = alb.artist_id;
SELECT *
from artist as art
full outer join album as alb
on art.artist_id = alb.artist_id;
SELECT name,title
from artist
CROSS join album;
select artist_id
from artist
union
select artist_id
from album;
select artist_id
from artist
union ALL
SELECT artist_id
from album;
select artist_id
from artist
INTERSECT
SELECT artist_id
from album;
select artist_id
from artist
EXCEPT
SELECT artist_id
from album;
select *
from album
where artist_id IN
(SELECT artist_id
FROM artist);
SELECT *
from album
where artist_id not in
(select artist_id
from artist);