Updating database with sql statement
The SELECT clause displays the table before the updates. The FROM clause specifies EMPLOYEES as the table to select from. The UPDATE statement updates the values in EMPLOYEES.
The SET clause specifies that the data in the Salary column be multiplied by 1.04 when the job code ends with a 1 and 1.025 for all other job codes.
You can create an action page to update data with either the cfupdate tag or cfquery with the UPDATE statement.
The cfupdate tag is the easiest way to handle simple updates from a front-end form.
Cold Fusion uses the primary key fields to select the record to update (therefore, you cannot update the primary key value itself).
The Contract field requires special treatment because a check box appears and sets its value.
The cfif structure puts a check mark in the check box if the Contract field value is Yes, and leaves the box empty otherwise.
After each exercise, we provide the solution so you can check your answer.
Bind variables are placeholders inside a SQL statement.