Explain the difference between INNER JOIN and LEFT JOIN with an example query for each.

 INNER JOIN: Returns only the rows with matching values in both tables.

SELECT employees.name, departments.department_name 

FROM employees

INNER JOIN departments ON employees.department_id = departments.id;



LEFT JOIN: Returns all rows from the left table and the matched rows from the right table. If there are no matches, NULL values are returned for columns from the right table.

SELECT customers.name, orders.order_id FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id;