0% found this document useful (0 votes)
9 views1 page

Join q1

Joins in SQL are used to combine rows from multiple tables based on related columns, facilitating meaningful data retrieval. The main types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN, and SELF JOIN. A CROSS JOIN specifically returns the Cartesian product of two tables, combining every row from the first table with every row from the second, regardless of any common columns.

Uploaded by

Manthan Arekar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Join q1

Joins in SQL are used to combine rows from multiple tables based on related columns, facilitating meaningful data retrieval. The main types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN, and SELF JOIN. A CROSS JOIN specifically returns the Cartesian product of two tables, combining every row from the first table with every row from the second, regardless of any common columns.

Uploaded by

Manthan Arekar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. What are Joins in SQL? State its types.

Joins in SQL are used to combine rows from two or more tables based on a related column.
They help retrieve data from multiple tables in a meaningful way.

Types of Joins:

1. INNER JOIN – Returns only matching records from both tables.


2. LEFT JOIN (LEFT OUTER JOIN) – Returns all records from the left table and
matching records from the right table; unmatched records from the right table are
NULL.
3. RIGHT JOIN (RIGHT OUTER JOIN) – Returns all records from the right table and
matching records from the left table; unmatched records from the left table are
NULL.
4. FULL JOIN (FULL OUTER JOIN) – Returns all records when there is a match in either
table; unmatched records from both tables are NULL.
5. CROSS JOIN – Returns the Cartesian product of both tables, meaning every row
from the first table is combined with every row from the second table.
6. SELF JOIN – A table joins itself based on a condition.

2. Define Cross Join

A Cross Join in SQL returns the Cartesian product of two tables, meaning each row from
the first table is combined with every row from the second table. It does not require a
common column between the tables.

Syntax:

SELECT * FROM table1


CROSS JOIN table2;

Example:

If table1 has 3 rows and table2 has 4 rows, the result will contain 3 × 4 = 12 rows.

You might also like