The INSERT Statement

The subset of SQL that enables you to insert data and to update and delete existing records in a table is known as the Data Manipulation Language.

The INSERT statement adds a new row of data to a table. At its simplest, INSERT is followed by a table name, the keyword VALUES, and a list of values in parentheses that correspond to each column in the table in turn.

The products table contains four columns—product_code, name, price, and weight—so you can insert a new product using the following statement:

mysql> INSERT INTO products
    -> VALUES ('NEWPROD', 'A new product', 19.99, 3.5);
Query OK, 1 row affected (0.02 sec)

The response from MySQL indicates that a row has been successfully inserted.

INTO

The INTO keyword is actually ...

Get Sams Teach Yourself MySQL 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.