INNER JOIN keyword Syntax
SELECT column_name (s) from Table_name1inner JOIN table_name2 on Table_name1.column_name=table_name2.column_name
Note: INNER join is the same as join.
You can use the following SELECT statement:
SELECT Persons.lastname, Persons.firstname, Orders.ordernofrom personsinner JOIN Orderson persons.id_p=orders.id_ Porder by Persons.lastname
SQL left JOIN keyword
The left JOIN keyword returns all rows from the table (TABLE_NAME1), even if there are no matching rows in the right table (table_name2).
Left JOIN keyword syntax
SELECT column_name (s) from Table_name1left JOIN table_name2 on Table_name1.column_name=table_name2.column_name
Note: In some databases, the left join is called the left OUTER join.
SELECT Persons.lastname, Persons.firstname, Orders.ordernofrom personsleft JOIN Orderson persons.id_p=orders.id_ Porder by Persons.lastname
SQL Right JOIN keyword
The right JOIN keyword returns all rows from the table (table_name2), even if there are no matching rows in the left table (table_name1).
Right JOIN keyword syntax
SELECT column_name (s) from Table_name1right JOIN table_name2 on Table_name1.column_name=table_name2.column_name
Note: In some databases, the right join is called a OUTER join.
SELECT Persons.lastname, Persons.firstname, Orders.ordernofrom personsright JOIN Orderson persons.id_p=orders.id_ Porder by Persons.lastname
SQL Full JOIN keyword
The full JOIN keyword returns a row whenever there is a match in one of the tables.
Full JOIN keyword syntax
SELECT column_name (s) from Table_name1full JOIN table_name2 on Table_name1.column_name=table_name2.column_name
Note: In some databases, full join is called full OUTER join.
SELECT Persons.lastname, Persons.firstname, Orders.ordernofrom personsfull JOIN Orderson persons.id_p=orders.id_ Porder by Persons.lastname
Different SQL JOIN