Can you explain the difference between a left join and a right join?

A left join (LEFT OUTER JOIN) returns all the records from the left table (table1) and the matching records from the right table (table2). If there's no match, the result will contain NULL values for the columns from the right table.

A right join (RIGHT OUTER JOIN) returns all the records from the right table (table2) and the matching records from the left table (table1). If there's no match, the result will contain NULL values for the columns from the left table.

In other words, a left join returns all the records from the left table, while a right join returns all the records from the right table. The difference lies in which table's records are returned in the case of non-matching records.