Even relatively simplistic data-driven applications rely on queries involving several tables. For instance, suppose you were charged with creating a human resources application and wanted to create an interface that displays each employee’s name, e-mail address, total number of absences, and bonuses. The query might look like this:
SELECT emp.employee_id, emp.firstname, emp.lastname, emp.email,
COUNT(att.absence) AS absences, COUNT(att.vacation) AS vacation,
SUM(comp.bonus) AS bonus
FROM employees emp, attendance att, compensation comp
WHERE emp.employee_id = att.employee_id ...