(a) Consider the following tables – Bank_Account and Branch:
Table: Bank_Account
ACod |
Name |
Type |
A01 | Amrita | Savings |
A02 | Parthodas | Current |
A03 | Miraben | Current |
Table: Branch
ACode |
City |
A01 | Delhi |
A02 | Mumbai |
A01 | Nagpur |
What will be the output of the following statement?
SELECT * FROM Bank_Account NATURAL JOIN Branch;
Answer:
Explanation:
Natural join compares columns of both tables and combines rows of both the tables based on columns that have the same name and data type in both the tables. The resultant table will have the common column only once.
In the tables Bank_Account and Branch, ACode is the common column and its data type is the same in both tables. So, the two tables are combined based on the column ACode.