5.Inserting, Deleting, and Updating Data

In this chapter, we will look at how to insert and change data in your MySQL database with the INSERT, DELETE, and UPDATE statements.

We will cover the following:

• Using INSERT

• Using DELETE

• Using UPDATE

• Uploading data with LOAD DATA INFILE

• Extensions: REPLACE and TRUNCATE

We have now moved into the DML (Data Manipulation Language) aspects of SQL. After we have learned how to insert data into a database, we will spend the next few chapters learning the many and varied ways to retrieve data from a database.


The INSERT SQL statement is used to insert rows into a table. We'll begin by looking at an example. Again, you can type these statements directly into the MySQL ...

Get MySQL Tutorial now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.