Modifying Data

You use the SQL UPDATE statement to update one or more columns. This usually involves specifying the following:

  • The table containing the data you want to update.

  • The column or columns you want to update, preceded by the SET keyword. If you specify more than one item, each must be separated by a comma.

  • An optional WHERE clause to specify which rows to update. If no WHERE clause is provided, all rows are updated.

Try updating a row. Enter the following SQL statement (ensuring that the ID number used in the WHERE clause is the DirectorID you noted earlier).

UPDATE Directors
SET FirstName='Ben'
WHERE DirectorID = 14

Click Execute to perform the update. Again, no results will be displayed, as UPDATE doesn’t return data (although the SQL, ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.