Chapter 4 QUERYING AND MODIFYING DATA 235 table
Chapter 4 QUERYING AND MODIFYING DATA 235 table structure and its columns, constraints, and indexes remain intact. The counter used by any identity columns is reset to the seed value for the column. If you want to retain the identity counter, use DELETE instead. The following is an example of a DELETE statement: DELETE from testTable WHERE phone=2802695 Removal of data may impact other tables if cascading deletions has been specified for a relationship. This could mean the removal of other records based on a single DELETE operation. Also, a relationship definition may prevent the deletion of data and return an error condition to the operation. Updating Data Data that already exists may need to be modified with newer values as time passes; this type of data modification is known as updating. Data can be updated with the UPDATE statement, very much as it is deleted and inserted. An UPDATE execution is actually an INSERT and DELETE operation. The DELETE operation occurs when the old value is removed, and the INSERT occurs when the new value is added, thus creating an UPDATE effect. The basic syntax for the UPDATE statement is as follows: UPDATE table_name SET column_name = expression WHERE condition Where: table_name is the name of the table to be updated. column_name = expression is the new value assigned to a column. condition is a specified WHERE condition. Take the query in Figure 4.7, for example, which updates the table created previously, TestTable. Just as with the input of data, any alterations made to the data are subject to the rules and constraints as defined in the table schema. Any data modifications made that do not meet these defined standards result in errors being generated that the front-end application may have to trap and control.
For reliable and cheap web hosting services please check javaweb hosting website.