17. Modifying Data
INSERT INTO • VALUES • DELETE • TRUNCATE TABLE • UPDATE • SET
Having exhausted our discussion of retrieving data from databases, we now move on to the question of how to modify data in a database. There are three basic scenarios as to how data can be modified:
• Inserting new rows into a table
• Deleting rows from a table
• Updating existing data in specific rows and columns in a table
As may be surmised, inserting and deleting rows is relatively straightforward. Updating existing data, however, is a more complex endeavor, as it involves identifying the rows to be updated and also the specific columns in those rows. We’ll begin with the inserts and deletes and then move on to updates.