[mysql] insert
Syntax:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name [(col_name,...)]
{VALUES | VALUE} ({expr | DEFAULT},...),(...),...
[ on DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
Or:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
SET col_name={expr | DEFAULT}, ...
[ on DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
Or:
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name [(col_name,...)]
SELECT ...
[ on DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
> select * from topic;
+----+------------+-------------------+---------------------+----------+---------+
| id | title | description | created | author | profile |
+----+------------+-------------------+---------------------+----------+---------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | egoing | NULL |
| 2 | Oracle | Oracle is ... | 2018-01-03 13:01:10 | kio | NULL |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | kiostory | NULL |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | freebee | NULL |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | cookieg | NULL |
+----+------------+-------------------+---------------------+----------+---------+
5 rows in set (0.0059 sec)
> insert into topic values('','CUBRID','CUBRID is ...',now(),'kio','I am me.');
Query OK, 1 row affected, 1 warning (0.0111 sec)
Warning (code 1366): Incorrect integer value: '' for column 'id' at row 1
> select * from topic;
+----+------------+-------------------+---------------------+----------+----------+
| id | title | description | created | author | profile |
+----+------------+-------------------+---------------------+----------+----------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | egoing | NULL |
| 2 | Oracle | Oracle is ... | 2018-01-03 13:01:10 | kio | NULL |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | kiostory | NULL |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | freebee | NULL |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | cookieg | NULL |
| 6 | CUBRID | CUBRID is ... | 2019-02-25 14:14:34 | kio | I am me. |
+----+------------+-------------------+---------------------+----------+----------+