2.7. INSERT

An insert query is used to add data to the database, a row at a time.

2.7.1. Syntax

insert into tablename values (value1, value2, value3);

2.7.2. Examples

insert into stock_item values (0, 'doodad', 9.95, 12);

Note that since the id field is an auto_increment field in the Acme inventory database we've set up, we don't need to specify a value to go in there, and just use zero instead --- whatever we specify will be replaced with the auto-incremented value. Auto-increment fields of some kind are available in most database systems, and are very useful for creating unique ID numbers.