insert multiple row in SQL is very easy. don't worry about it.
mysql> create table orders(orderid varchar(10), customerid varchar(10), orderdate varchar(10));
Query OK, 0 rows affected (0.02 sec)
mysql> desc orders;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| orderid | varchar(10) | YES | | NULL | |
| customerid | varchar(10) | YES | | NULL | |
| orderdate | varchar(10) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
mysql> insert into orders(orderid,customerid,orderdate) values ('10308', '2', '1996-09-18'), ('10309', '37', '1996-09-19'), ('10310', '77', '1996-09-20');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from orders;
+---------+------------+------------+
| orderid | customerid | orderdate |
+---------+------------+------------+
| 10308 | 2 | 1996-09-18 |
| 10309 | 37 | 1996-09-19 |
| 10310 | 77 | 1996-09-20 |
+---------+------------+------------+
3 rows in set (0.00 sec)
mysql> create table orders(orderid varchar(10), customerid varchar(10), orderdate varchar(10));
Query OK, 0 rows affected (0.02 sec)
mysql> desc orders;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| orderid | varchar(10) | YES | | NULL | |
| customerid | varchar(10) | YES | | NULL | |
| orderdate | varchar(10) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
mysql> insert into orders(orderid,customerid,orderdate) values ('10308', '2', '1996-09-18'), ('10309', '37', '1996-09-19'), ('10310', '77', '1996-09-20');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from orders;
+---------+------------+------------+
| orderid | customerid | orderdate |
+---------+------------+------------+
| 10308 | 2 | 1996-09-18 |
| 10309 | 37 | 1996-09-19 |
| 10310 | 77 | 1996-09-20 |
+---------+------------+------------+
3 rows in set (0.00 sec)
Comments
Post a Comment