Skip to main content


By October 3, 2013No Comments

Previously, we looked at creating tables with FOREIGN KEY constraints. Although this is better for data management it does not help with queries as the column data in a single table no longer has much meaning on its own; we need to use JOINS in the SELECT statement. In this video we start by inserting data and then running queries. The final JOIN statement between the employees and department table will look similar to this:

SELECT e.ename , d.dname
FROM employees AS e
JOIN departments as d
ON e.did = d.did;

The result should look like this where we can show the department name against the user, only the Department ID exists in the employees table.