INSERT INTO tbl_name  (col1,col2) VALUES(15,col1*2); 

But the following is not legal, because the value for col1  refers to col2 , which is assigned after col1 : 

INSERT INTO tbl_name  (col1,col2) VALUES(col2*2,15); 

An exception occurs for columns that contain AUTO_INCREMENT  values. Because AUTO_INCREMENT values are generated after other value assignments, any reference to an AUTO_INCREMENT  column in the assignment returns a 0 . 

INSERT  statements that use VALUES  syntax can insert multiple rows. To do this, include multiple lists of comma-separated column values, with lists enclosed within parentheses and separated by commas. Example: 

INSERT INTO tbl_name  (a,b,c) VALUES(1,2,3), (4,5,6), (7,8,9); 

Each values list must contain exactly as many values as are to be inserted per row. The following statement is invalid because it contains one list of nine values, rather than three lists of three values each: 

INSERT INTO tbl_name  (a,b,c) VALUES(1,2,3,4,5,6,7,8,9); 

VALUE  is a synonym for VALUES  in this context. Neither implies anything about the number of values lists, nor about the number of values per list. Either may be used whether there is a single values list or multiple lists, and regardless of the number of values per list. 

INSERT  statements using VALUES ROW()  syntax can also insert multiple rows. In this case, each value list must be contained within a ROW()  (row constructor), like this: 

INSERT INTO tbl_name  (a,b,c) VALUES ROW(1,2,3), ROW(4,5,6), ROW(7,8,9); 

The affected-rows value for an INSERT  can be obtained using the ROW_COUNT()  SQL function or the mysql_affected_rows() C API function. See Section 12.16, “Information Functions” , and mysql_affected_rows(). 

If you use INSERT ... VALUES  or INSERT ... VALUES ROW()  with multiple value lists, or INSERT ... SELECT  or INSERT ... TABLE , the statement returns an information string in this format: 

Records: N1  Duplicates: N2  Warnings: N3 

If you are using the C API, the information string can be obtained by invoking the mysql_info()  function. See mysql_info(). 

Records  indicates the number of rows processed by the statement. (This is not necessarily the number of rows actually inserted because Duplicates  can be nonzero.) Duplicates  indicates the number of rows that could not be inserted because they would duplicate some existing unique index value. Warnings indicates the number of attempts to insert column values that were problematic in some way. Warnings can occur under any of the following conditions: 

•Inserting NULL  into a column that has been declared NOT NULL . For multiple-row INSERT  statements or INSERT INTO ... SELECT  statements, the column is set to the implicit default value for the column data type. This is 0  for numeric types, the empty string ( ’’ ) for string types, and the “zero”  value for date and time types. INSERT INTO ... SELECT  statements are handled the same way as multiple-row inserts because the server does not examine the result set from the SELECT  to see whether it returns a single row. (For a single-row INSERT , no warning occurs when NULL  is inserted into a NOT NULL column. Instead, the statement fails with an error.) 

