LEFT JOIN and NULL Handling
  • Description: Use LEFT JOIN to retrieve data even when there’s no matching record in the joined table. Retrieve all employees and their project names, including those without assigned projects.
  • Table Used: employees, departments
    • employees Columns: employee_id, first_name, last_name, department_id, salary
    • departments Columns: department_id, department_name
  • Expected Columns Returned: employee_id, first_name, last_name, department_name
  • Schema:
classDiagram direction BT class departments { varchar(50) department_name int department_id } class employees { varchar(50) first_name varchar(50) last_name int department_id decimal(10,2) salary int employee_id } employees --> departments : department_id

select * from employees