Insert more than one rows in a single insert statement : Insert « Insert Update Delete « MySQL Tutorial






mysql>
mysql>
mysql> CREATE TABLE employee (
    ->      id MEDIUMINT NOT NULL AUTO_INCREMENT,
    ->      name CHAR(30) NOT NULL,
    ->      PRIMARY KEY (id)
    ->  );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> INSERT INTO employee (name) VALUES ('A'),
    ->                                    ('B'),
    ->                                    ('C'),
    ->                                    ('D'),
    ->                                    ('E'),
    ->                                    ('F');
Query OK, 6 rows affected (0.00 sec)
Records: 6  Duplicates: 0  Warnings: 0

mysql>
mysql> SELECT * FROM employee;
+----+------+
| id | name |
+----+------+
|  1 | A    |
|  2 | B    |
|  3 | C    |
|  4 | D    |
|  5 | E    |
|  6 | F    |
+----+------+
6 rows in set (0.00 sec)

mysql>
mysql> drop table employee;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>








7.1.Insert
7.1.1.INSERTing data
7.1.2.Insert more than one rows in a single insert statement
7.1.3.Insert two rows with one insert statement
7.1.4.Do calculation in the insert statement referencing the column name
7.1.5.Insert quotation marks
7.1.6.Insert NULL to a NOT NULL column
7.1.7.Insert with set statement
7.1.8.Use the DEFAULT in the insert statement
7.1.9.Using encode function with insert statement