How to Work With Cross Join in SQL

In this article I am going to explain about how to work with cross join in SQL.
  • 2227

Introduction

Here I am going to explain how to retrieve data from more than one table. Join operator is used to fetch data from two or more than two table. Here we use cross join to fetch data from two different tables in result set table.

Cross join joins each row from the first table with each row from second table. Cross join provide Cartesian Product of two tables. In statement we use CROSS JOIN clause to implement cross join.s  

A Statement that create mcninvoices table

inv.jpg

Statements that insert data in mcninvoices table

inv (2).jpg

A Statement that is used to fetch data from mcninvoices table

inv111.jpg

A Statement that create vendors table

ven.jpg

Statements that insert data in vendors table

ven (1).jpg

A Statement that is used to fetch data from vendors table

ven (2).jpg

A Statement that retrieve data from two table using Cartesian Product

Clipboard12.jpg


© 2019 DotNetHeaven. All rights reserved.