EquiJoin Example
EquiJoin Example
Let us understand how equijoin works in MySQL through examples. Suppose we have
already two tables named customer and balance that contains the following data:
We can also get the same result by using the below statement:
To join three tables using equijoin, we need to execute the statement as follows:
Syntax:
The following is a basic syntax to illustrate the natural join:
1. SELECT [column_names | *]
2. FROM table_name1
3. NATURAL JOIN table_name2;
In this syntax, we need to specify the column names to be included in the result set after
the SELECT keyword. If we want to select all columns from both tables, the * operator will
be used. Next, we will specify the table names for joining after the FROM keyword and
write the NATURAL JOIN clause between them.
In this image, we can see that column names id and account and its data types are the
same that fulfill the natural join criteria. Hence we can use natural join on them.
Execute the below statement for joining tables using natural join:
1. SELECT [column_names | *]
2. FROM table_name1
3. NATURAL JOIN table_name2
4. NATURAL JOIN table_name3;
Let us create another table named cust_info using the below statement:
To join three tables using natural join, we need to execute the statement as follows:
https://www.learnpython4cbse.com/practical-file-programs-c-sc-xii
https://www.shaalaa.com/search-important-solutions/cbse-class-12-senior-school-cert-examination-
science_1424?subjects=computer-science-python_2869
no_punc = “ “
print (no_punc)