Sql: what is the difference between inner join and left join?
Example:
SELECT * FROM users INNER JOIN orders ON users.id = orders.user_id;
An INNER JOIN returns rows when there is a match in both tables. A LEFT JOIN returns all rows from the left table and the matching rows from the right table. If there is no match, NULL values will be returned for right table's columns.
Solution:
SELECT * FROM users LEFT JOIN orders ON users.id = orders.user_id;