Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views4 pages

SQL Table Joins

The document outlines different types of table joins in SQL, including Cross Join, Equi Join, and Natural Join, explaining their purposes and how they operate. It provides SQL query examples for each join type and highlights the characteristics of the resulting datasets. The learning objectives include differentiating join types, executing them, and interpreting query outputs.

Uploaded by

chillguybored123
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)
12 views4 pages

SQL Table Joins

The document outlines different types of table joins in SQL, including Cross Join, Equi Join, and Natural Join, explaining their purposes and how they operate. It provides SQL query examples for each join type and highlights the characteristics of the resulting datasets. The learning objectives include differentiating join types, executing them, and interpreting query outputs.

Uploaded by

chillguybored123
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/ 4

LO: To differentiate the various types of table joins.

To execute table joins using suitable join types.


To interpret the output for a given query. SUCCESS CRITERIA

Cross Join: A Cross Join returns the Cartesian product of two tables, combining each row of the
To explain the purpose
first table with every row of the second. It is used when all possible combinations of the rows
of joins.
are needed, often resulting in a large number of rows.

Equi Join: An Equi Join retrieves rows from two or more tables based on a matching column
using the equality operator (=). It requires specifying the join condition explicitly using a WHERE To list the key
or ON clause. differences between
the types of joins.
Natural Join: A Natural Join automatically joins tables based on columns with the same name
and compatible data types. It eliminates duplicate columns in the result and does not require To write sql queries
specifying the join condition. using table joins.

To predict the output


for a given join query.
CROSS JOIN

Returns all possible combinations of records.


Degree of cross joined table is the sum of degrees of individual table.
SELECT * FROM SENDER,RECEIVER;
Cardinality of cross joined table is the product of cardinalities of individual table.
SELECT * FROM SENDER JOIN RECEIVER;
EQUI JOIN
Combines records from multiple table based on common columns.

SELECT * FROM SENDER,RECEIVER WHERE


SENDER.S_ID = RECEIVER.S_ID;

SELECT * FROM SENDER JOIN RECEIVER ON


SENDER.S_ID = RECEIVER.S_ID;
NATURAL JOIN
Combines records from multiple table based on common
columns eliminating the duplicate columns in the output table.

SELECT S.S_ID,R.R_CITY FROM SENDER S,


RECEIVER R WHERE S.S_ID = R.S_ID;

SELECT S.S_ID,R.R_CITY FROM SENDER S


NATURAL JOIN RECEIVER R;

You might also like