Chapter 10. Inserting, Updating, and Deleting Rows

To this point, I've explained how to use SELECT to retrieve and analyze the data in tables. In this chapter, I'll explain how to use SQL statements to modify table data:

  • The INSERT statement adds new rows to a table.

  • The UPDATE statement changes the values in a table's existing rows.

  • The DELETE statement removes rows from a table.

These statements don't return a result, but your DBMS normally will print a message indicating whether the statement ran successfully and, if so, the number of rows affected by the change. To see the actual effect the statement had on a table, use a SELECT statement such as SELECT * FROM table;.

Unlike SELECT, which only accesses data, these statements change data, so your ...

Get SQL: Visual Quickstart Guide, Second Edition 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.