"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from R ***" as "Select";
b c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R cross join S" as "cross join";
count
12

(1 row)

a b c
1 1 6
1 1 7
1 4 8
1 4 9
2 1 6
2 1 7
2 4 8
2 4 9
3 1 6
3 1 7
3 4 8
3 4 9

(12 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
b c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R inner join S on R.A = S.B" as "inner join";
count
2

(1 row)

a b c
1 1 6
1 1 7

(2 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
b c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R left join S on R.A = S.B" as "left join";
count
4

(1 row)

a b c
1 1 6
1 1 7
2    
3    

(4 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
b c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R right join S on R.A = S.B" as "right join";
count
4

(1 row)

a b c
1 1 6
1 1 7
  4 8
  4 9

(4 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
b c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R natural join S" as "natural join";
count
12

(1 row)

a b c
1 1 6
1 1 7
1 4 8
1 4 9
2 1 6
2 1 7
2 4 8
2 4 9
3 1 6
3 1 7
3 4 8
3 4 9

(12 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select count(*)/* from R cross join S" as "cross join";
count
12

(1 row)

a a c
1 6 1
1 7 2
1 8 3
1 9 4
2 6 1
2 7 2
2 8 3
2 9 4
3 6 1
3 7 2
3 8 3
3 9 4

(12 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select count(*)/* from R inner join S using (A)" as "inner join";
count
0

(1 row)

a c

(0 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select count(*)/* from R left join S using(A)" as "left join";
count
3

(1 row)

a c
1  
2  
3  

(3 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select count(*)/* from R right join S using(A)" as "right join";
count
4

(1 row)

a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
6 1
7 2
8 3
9 4

(4 rows)

"*** select count(*)/* from R natural join S" as "natural join";
count
0

(1 row)

a c

(0 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R cross join S" as "cross join";
count
12

(1 row)

a a c
1 1 6
1 1 7
1 4 8
1 4 9
2 1 6
2 1 7
2 4 8
2 4 9
3 1 6
3 1 7
3 4 8
3 4 9

(12 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R inner join S" as "inner join";
count
2

(1 row)

a c
1 6
1 7

(2 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R left join S using(A)" as "left join";
count
4

(1 row)

a c
1 6
1 7
2  
3  

(4 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R right join S using(A)" as "right join";
count
4

(1 row)

a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select * from R ***" as "Select";
a
1
2
3

(3 rows)

"*** select * from S ***" as "Select";
a c
1 6
1 7
4 8
4 9

(4 rows)

"*** select count(*)/* from R natural join S" as "natural join";
count
2

(1 row)

a c
1 6
1 7

(2 rows)

"*** select * from R ***" as "Select";
a b
1 4
2 5
3 6

(3 rows)

"*** select * from S ***" as "Select";
a c d
1 3 4
1 4 5
1 4 6
2 4 7
2 5 8
4 7 9

(6 rows)

"*** select count(*)/* from R cross join S" as "cross join";
count
18

(1 row)

a b a c d
1 4 1 3 4
1 4 1 4 5
1 4 1 4 6
1 4 2 4 7
1 4 2 5 8
1 4 4 7 9
2 5 1 3 4
2 5 1 4 5
2 5 1 4 6
2 5 2 4 7
2 5 2 5 8
2 5 4 7 9
3 6 1 3 4
3 6 1 4 5
3 6 1 4 6
3 6 2 4 7
3 6 2 5 8
3 6 4 7 9

(18 rows)

"*** select * from R ***" as "Select";
a b
1 4
2 5
3 6

(3 rows)

"*** select * from S ***" as "Select";
a c d
1 3 4
1 4 5
1 4 6
2 4 7
2 5 8
4 7 9

(6 rows)

"*** select count(*)/* from R inner join S" as "inner join";
count
5

(1 row)

a b a c d
1 4 1 3 4
1 4 1 4 5
1 4 1 4 6
2 5 2 4 7
2 5 2 5 8

(5 rows)

"*** select * from R ***" as "Select";
a b
1 4
2 5
3 6

(3 rows)

"*** select * from S ***" as "Select";
a c d
1 3 4
1 4 5
1 4 6
2 4 7
2 5 8
4 7 9

(6 rows)

"*** select count(*)/* from R left join S on R.A = S.A" as "left join";
count
6

(1 row)

a b a c d
1 4 1 3 4
1 4 1 4 5
1 4 1 4 6
2 5 2 4 7
2 5 2 5 8
3 6      

(6 rows)

"*** select * from R ***" as "Select";
a b
1 4
2 5
3 6

(3 rows)

"*** select * from S ***" as "Select";
a c d
1 3 4
1 4 5
1 4 6
2 4 7
2 5 8
4 7 9

(6 rows)

"*** select count(*)/* from R right join S on R.A = S.A" as "right join";
count
6

(1 row)

a b a c d
1 4 1 3 4
1 4 1 4 5
1 4 1 4 6
2 5 2 4 7
2 5 2 5 8
    4 7 9

(6 rows)

"*** select * from R ***" as "Select";
a b
1 4
2 5
3 6

(3 rows)

"*** select * from S ***" as "Select";
a c d
1 3 4
1 4 5
1 4 6
2 4 7
2 5 8
4 7 9

(6 rows)

"*** select count(*)/* from R natural join S" as "natural join";
count
5

(1 row)

a b c d
1 4 3 4
1 4 4 5
1 4 4 6
2 5 4 7
2 5 5 8

(5 rows)

"*** select * from T ***" as "Select";
a
1
2
3

(3 rows)

"*** select count(*)/* from T as R cross join T as S" as "cross join";
count
9

(1 row)

a a
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3

(9 rows)

"*** select * from T ***" as "Select";
a
1
2
3

(3 rows)

"*** select count(*)/* from T as R inner join T as S" as "inner join";
count
3

(1 row)

a
1
2
3

(3 rows)

"*** select * from T ***" as "Select";
a
1
2
3

(3 rows)

"*** select count(*)/* from T as R left join T as S using (A)" as "left join";
count
3

(1 row)

a
1
2
3

(3 rows)

"*** select * from T ***" as "Select";
a
1
2
3

(3 rows)

"*** select count(*)/* from T as R right join T as S using (A)" as "right join";
count
3

(1 row)

a
1
2
3

(3 rows)

"*** select * from T ***" as "Select";
a
1
2
3

(3 rows)

"*** select count(*)/* from T as R natural join T as S using (A)" as "natural join";
count
3

(1 row)

a
1
2
3

(3 rows)