Adding, Changing, and Removing Data

Once you've designed and created a database, its tables, and (optionally) its indexes, you'll want to put data into the tables and start to work—adding, changing, and removing data as necessary. You've got the structure; now you need some contents.

SQL provides three basic commands for changing data, collectively called data modification statements.

  • The INSERT statement adds new rows to the database.

  • The UPDATE statement changes existing rows in the database.

  • The DELETE statement removes rows from the database.

This section discusses the SQL data modification commands. The next section gives samples of the INSERT statements that load the sample data from the bookbiz database.

Another method of adding data to ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth 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.