Yes. You need to add cat_t.date_key=date_t.date_key
to avoid the cartesian join.
But you still have a cross-join problem with tables cat_t
and dog_t
. I would say you should union a separated select from each table.
Question
Would this be a Cartesian join:
select
dog_t.type
dog_t.breed
date_t.date
from
dog_t,
cat_t,
date_t
where
dog_t.date_key=date_t.date_key
Would including the cat_t table cause a Cartesian join... because it isn't joined to anything?
Solution
Yes. You need to add cat_t.date_key=date_t.date_key
to avoid the cartesian join.
But you still have a cross-join problem with tables cat_t
and dog_t
. I would say you should union a separated select from each table.