Skip to content
  • SiteMap
  • Our Services
  • Frequently Asked Questions (FAQ)
  • Support
  • About Us

UpdateGadh

Update Your Skills.

  • Home
  • Projects
    •  Blockchain projects
    • Python Project
    • Data Science
    •  Ai projects
    • Machine Learning
    • PHP Project
    • React Projects
    • Java Project
    • SpringBoot
    • JSP Projects
    • Java Script Projects
    • Code Snippet
    • Free Projects
  • Tutorials
    • Ai
    • Machine Learning
    • Advance Python
    • Advance SQL
    • DBMS Tutorial
    • Data Analyst
    • Deep Learning Tutorial
    • Data Science
    • Nodejs Tutorial
  • Blog
  • Contact us
  • Toggle search form
SQL CROSS JOIN

Understanding SQL CROSS JOIN with Examples

Posted on March 15, 2025March 15, 2025 By Rishabh saini No Comments on Understanding SQL CROSS JOIN with Examples

SQL CROSS JOIN

The JOIN operation in SQL allows us to combine multiple tables into a single dataset. One of the simplest types of joins is the CROSS JOIN, also known as a Cartesian Join. This operation returns the Cartesian product of the sets of rows from the joined tables. This means that each row from the first table is combined with every row from the second table, leading to a final table whose total number of rows is equal to the product of the number of rows in each table.

For example, if Table 1 has 2 rows and Table 2 has 3 rows, performing a CROSS JOIN will result in 2 × 3 = 6 rows in the final dataset.

Complete Python Course with Advance topics:-Click Here
SQL Tutorial :-Click Here

SQL Syntax for CROSS JOIN

SELECT TableName1.columnName1, TableName2.columnName2 
FROM TableName1 
CROSS JOIN TableName2;

This basic syntax retrieves all possible row combinations between the two tables.

Now, let’s explore CROSS JOIN in detail using MySQL examples.

Example 1: CROSS JOIN Between MatchScore and Departments Tables

Given Tables:

MatchScore

PlayerDepartment_idGoals
Franklin12
Alan13
Priyanka22
Rajesh35

Departments

Department_idDepartment_name
1IT
2HR
3Marketing

Query:

SELECT * FROM MatchScore 
CROSS JOIN Departments;

Output:

After executing this query, the result will contain 4 × 3 = 12 rows:

PlayerDepartment_idGoalsDepartment_idDepartment_name
Franklin121IT
Alan131IT
Priyanka221IT
Rajesh351IT
Franklin122HR
……………

Each row from MatchScore is combined with every row from Departments.

Example 2: CROSS JOIN Between Employee and Department Tables

Given Tables:

Employee

EmployeeIDEmployee_NameEmployee_Salary
1Arun Tiwari50000
2Sachin Rathi64000
3Harshal Pathak48000
4Arjun Kuwar46000
5Sarthak Gada62000

Department

DepartmentIDDepartment_Name
1Production
2Sales
3Marketing
4Accounts

Query:

SELECT * FROM Employee 
CROSS JOIN Department;

Output:

After execution, we get 5 × 4 = 20 rows combining each employee with each department.

Example 3: CROSS JOIN Between Loan and Borrower Tables

Given Tables:

Loan

LoanIDBranchAmount
1B115000
2B210000
3B320000
4B4100000

Borrower

CustIDCustName
1Sonakshi Dixit
2Shital Garg
3Swara Joshi
4Isha Deshmukh

Query:

SELECT * FROM Loan 
CROSS JOIN Borrower;

Output:

Since there are 4 loans and 4 borrowers, the resulting dataset contains 4 × 4 = 16 rows.

Example 4: CROSS JOIN Between Customer and Orders Tables

Given Tables:

Customer

Customer_IDNameAgeSalary
1Aryan Jain5156000
2Arohi Dixit2125000
3Vineet Garg2431000

Orders

Order_IDOrder_DateAmount
12012-01-203000
22012-05-182000
32012-06-284000

Query:

SELECT * FROM Customer 
CROSS JOIN Orders;

Output:

Since there are 3 customers and 3 orders, we get 3 × 3 = 9 rows.

Download New Real Time Projects :-Click here
Complete Advance AI topics:- CLICK HERE

Conclusion

SQL’s CROSS JOIN function combines every row of one table with every row of another table to produce a Cartesian product.
The product of the number of rows in the two tables determines the total number of rows in the result set.
Although helpful in certain situations, CROSS JOIN should be used with caution because it can generate enormous databases.

You may take advantage of CROSS JOIN’s capabilities in SQL queries while keeping performance issues in mind if you understand it.


sql cross join vs full join
sql scross join example
sql cross join in sql example
self join in sql
sql cross join vs inner join
sql cross join syntax
sql cross join in oracle
sql cross join in mysql
sql joins
cross join
sql cross join example
sql cross join w3schools
sql cross join multiple columns

Post Views: 518
SQL Tutorial Tags:cartesian join, cartesian join in sql, cross join, cross join in sql, cross join sql, cross join sql server, devops, join in sql, joins in sql server, software testing mentor sql, sql, sql cartesian join, sql cross join, sql join, sql join queries with examples, sql joins, sql joins interview questions, sql joins interview questions and answers, sql joins tutorial, sql joins with examples, sql server cross join, sql tutorial, sql tutorial for beginners

Post navigation

Previous Post: SQL FULL JOIN – A Complete Guide
Next Post: Dynamic Web Project Missing in Eclipse IDE – How to Fix It (2025)

More Related Articles

SQL INSERT STATEMENT SQL INSERT STATEMENT SQL Tutorial
SQL Tutorial: A Comprehensive Guide - SQL Tutorial : updategadh.com SQL Tutorial: A Comprehensive Guide SQL Tutorial
SQL LEFT JOIN Understanding SQL LEFT JOIN with Examples SQL Tutorial

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may also like

  1. Understanding the SQL DELETE Statement and Its Variants
  2. SQL Temporary Tables: A Handy Tool for Developers
  3. SQL SELECT TOP Clause: A Comprehensive Guide
  4. SQL ORDER BY LIMIT – Retrieve Specific Rows from a Database
  5. SQL FULL JOIN – A Complete Guide
  6. IN vs EXISTS in SQL: A Complete Guide

Most Viewed Posts

  1. Top Large Language Models in 2025
  2. Online Shopping System using PHP, MySQL with Free Source Code
  3. login form in php and mysql , Step-by-Step with Free Source Code
  4. Flipkart Clone using PHP And MYSQL Free Source Code
  5. News Portal Project in PHP and MySql Free Source Code
  6. User Login & Registration System Using PHP and MySQL Free Code
  7. Top 10 Final Year Project Ideas in Python
  8. Blog Site In PHP And MYSQL With Source Code || Best Project
  9. Online Bike Rental Management System Using PHP and MySQL
  10. E learning Website in php with Free source code
  • AI
  • ASP.NET
  • Blockchain
  • ChatCPT
  • code Snippets
  • Collage Projects
  • Data Science Project
  • Data Science Tutorial
  • DBMS Tutorial
  • Deep Learning Tutorial
  • Final Year Projects
  • Free Projects
  • How to
  • html
  • Interview Question
  • Java Notes
  • Java Project
  • Java Script Notes
  • JAVASCRIPT
  • Javascript Project
  • JSP JAVA(J2EE)
  • Machine Learning Project
  • Machine Learning Tutorial
  • MySQL Tutorial
  • Node.js Tutorial
  • PHP Project
  • Portfolio
  • Python
  • Python Interview Question
  • Python Projects
  • PythonFreeProject
  • React Free Project
  • React Projects
  • Spring boot
  • SQL Tutorial
  • TOP 10
  • Uncategorized
  • Real-Time Medical Queue & Appointment System with Django
  • Online Examination System in PHP with Source Code
  • AI Chatbot for College and Hospital
  • Job Portal Web Application in PHP MySQL
  • Online Tutorial Portal Site in PHP MySQL — Full Project with Source Code

Most Viewed Posts

  • Top Large Language Models in 2025 (8,616)
  • Online Shopping System using PHP, MySQL with Free Source Code (5,227)
  • login form in php and mysql , Step-by-Step with Free Source Code (4,876)

Copyright © 2026 UpdateGadh.

Powered by PressBook Green WordPress theme