This is a simple JOIN in which the result is based on matched data as per the equality condition specified in the query.
Inner Join Syntax is,
SELECT column-name-list from table-name1 INNER JOIN table-name2 WHERE table-name1.column-name = table-name2.column-name;
Example of Inner JOIN
The class table,
| ID | NAME |
|---|---|
| 1 | abhi |
| 2 | adam |
| 3 | alex |
| 4 | anu |
The class_info table,
| ID | Address |
|---|---|
| 1 | DELHI |
| 2 | MUMBAI |
| 3 | CHENNAI |
Inner JOIN query will be,
SELECT * from class, class_info where class.id = class_info.id;
The result table will look like,
| ID | NAME | ID | Address |
|---|---|---|---|
| 1 | abhi | 1 | DELHI |
| 2 | adam | 2 | MUMBAI |
| 3 | alex | 3 | CHENNAI |
No comments:
Post a Comment