To access the table to read or modify table data, you use the SQL programming language. For
example, the following SQL statement returns all rows from the table where the department ID
is 3:
SELECT * FROM employees WHERE DEPTID=3
Note: In this chapter, SQL keywords and syntax are always represented by uppercase letters. Table
and column names used mixed uppercase and lowercase letters.
Using multiple database tables
In many database designs, information is distributed to multiple tables. The following figure
shows two tables, one for employee information and one for employee addresses:
employees table
addresses table
In this example, each table contains a column named EmpID. This column associates a row of
the employees table with a row in the addresses table.
For example, to obtain all information about an employee, you request a row from the employees
table and the row from the addresses table with the same value for EmpID.
One advantage of using multiple tables is that you can add tables containing new information
without modifying the structure of your existing tables. For example, to add payroll information,
you add a new table to the database where the first column contains the employee's ID and the
columns contain current salary, previous salary, bonus payment, and 401(k) percent.
Also, an access to a small table is more efficient than an access to a large table. Therefore, if you
update the street address of an employee, you update only the addresses table, without having to
access any other table in the database.
What is a database?
413
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers