I have two tables, EMPLOYEE & DEPENDENT. The employee PK is SSN and the foreign key for the dependent table is ESSN. I am trying to retrieve the name of all employees and the names of their dependent. If an employee does not have a dependent, I just need to display a blank value in the dependent column.
To retrieve the name of employees who have dependents, this is the statement I use:
SELECT
firstName AS "First Name",
lastName AS "Last Name",
dependent_name AS "Dependent Name"
FROM employee,dependent
WHERE ssn=essn;
If somebody could guide me in the right direction, that would be greatly appreciated.