2.1.18. Queries and Joins
- Relational database allows inter-related data
- SQL select FROM gives Cartesian product
- WHERE clause defines join condition
- SELECT proj.pnum, mgr.ssn
- FROM project AS proj, employee AS mgr
- WHERE proj.mgrssn = mgr.ssn;
- Alternatively, explicitly define join (note type)
- SELECT project.pnum, employee.ssn
- FROM project INNER JOIN employee
- ON project.mgrssn = employee.ssn;