# Generic syntaxINSERT table_name (list, of, columns)VALUES (list, of, values);# Add one row to the book tableINSERT book (title, author, cond)VALUES ('Where the Wild Things Are', 'Maurice Sendak', 'fine');
The INSERT command allows you to add one or more rows to an existing table. The basic syntax of the command is quite simple. Piece-by-piece, the relevant bits of syntax are
INSERT Denotes the start of the command.
table_name The name of an existing table (such as book) to insert one or more rows of data into.
(list, of, columns, ...) A parenthesized list of column names. Columns not included in this list will be set to their default values in the rows that will be created.
The list of columns is optional. If it is omitted, it will be as if all columns were listed. Use of this behavior, however, is not at all recommended because the order of columns in a table cannot be trusted to remain consistent over time.
VALUES Lets MySQL know that a list of values should be coming next.
(list, of, values, ...) A parenthesized list of values that should correspond to the list of columns specified.
Note that not only values can be used in the listfunction calls, variables, and other exciting things are allowed as well. See the "Inserting the Current Date and Time (Using a MySQL Function)" phrase later in this chapter.