SQL INNER JOIN
An inner join is a join in which the values in the columns being joined are compared using a comparison operator.
SQL Inner Join syntax
SELECT column_name(s)
FROM A_table INNER JOIN B_table
ON A_table.column_name = B_table.column_name;
Training_Course
ID | NAME | DURATION | PRICE |
---|
1 | SQL | 5 | 200 |
2 | T-SQL | 7 | 700 |
3 | MySQL | 5 | 600 |
4 | PL/SQL | 7 | 800 |
5 | PostgreSQL | 6 | 500 |
Certifications
ID | NAME | PRICE | ID_TC |
---|
1 | PostgreSQL certification | 800 | 5 |
2 | SQL certification | 350 | 1 |
3 | T-SQL certification | 1000 | 2 |
Example
SELECT t.ID,t.NAME,t.PRICE
FROM Training_Course t INNER JOIN Certifications c
ON t.ID = c.ID_TC ;
Results
ID | NAME | PRICE |
---|
5 | PostgreSQL | 500 |
1 | SQL | 200 |
2 | T-SQL | 700 |