What if all the common attributes(where ever they are common) are the same value. I mean here X.a = Y.a, say all the common values have the same value say = "1" then max total tuples will be 60*60 + 40(nulls) = 3640. and applying the same logic to the whole question we get max as 252070 tuples.
Please look at the tables and corresponding queries. it is a smaller database but obeys the approach and conditions that are mentioned in the question.
size of X = 10 , Y = 8, Z = 9 ;
common(X, Y) = 6, common(Y,Z) = 7
Result Set X
select * from X ;
A |
B |
C |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
2 |
10 |
11 |
3 |
10 |
11 |
4 |
10 |
11 |
5 |
10 |
11 |
Download CSV
10 rows selected.
Result Set Y
select * from Y;
A |
D |
E |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
1 |
10 |
11 |
44 |
10 |
11 |
44 |
11 |
11 |
Download CSV
8 rows selected.
Result Set Z
select * from Z ;
P |
D |
F |
1 |
10 |
11 |
2 |
10 |
11 |
3 |
10 |
11 |
4 |
10 |
11 |
5 |
10 |
11 |
6 |
10 |
11 |
7 |
10 |
11 |
3 |
11 |
11 |
32 |
234 |
32 |
Download CSV
9 rows selected.
Result Set
select count(*) from X left join Y on X.a = Y.a full outer join Z on Y.d = Z.d ;
Download CSV