Accessing Multiple Tables
|
||||
Sometimes you need to display data from more than one table. You can use SELECT statements to query more than one table. The FROM clause of your query contains the names of the tables from which you are retrieving data. Because information comes from more than one table, this is called a JOIN between the tables involved. For example, in the EMPLOYEES table, the DEPARTMENT_ID column represents the department number for an employee. In the DEPARTMENTS table, there is a DEPARTMENT_ID column as well as a DEPARTMENT_NAME column. You can join the EMPLOYEES and DEPARTMENTS tables using the DEPARTMENT_ID column to produce a report that shows the employees' names and department names. |