Jeff Smith Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server

Full Outer Join versus Cross Join

Here is a comparison of a FULL OUTER JOIN and a CROSS JOIN to achieve the same results. See here for more information on this. – Prepare environment:create table A (id int primary key, descr varchar(100))create table seq (seq int primary key)create table B (id int references A(id), seq int references seq(seq), value money, primary key (id,seq))create table C (id int references A(id), seq int references seq(seq), value money, primary key (id,seq))go– Create sample data:insert into Aselect number, 'Name ' + convert(varchar(10), number)from master. Read more →

Full Outer Join versus Union All

(see here for more information on this ) – set it all up: create table A (id int primary key, descr varchar(100))create table B (id int references A(id), seq int, value money, primary key (id,seq))create table C (id int references A(id), seq int, value money, primary key (id,seq))goinsert into Aselect number, 'Name ' + convert(varchar(10), number)from master. Read more →