1INSERT INTO table_name(c1)
2VALUES(c1)
3ON DUPLICATE KEY UPDATE c1 = VALUES(c1) + 1;
1--sql insert quest example
2INSERT INTO table_name (column1, column2, column3, ...)
3VALUES (value1, value2, value3, ...);
1INSERT INTO films
2 (code, title, did, date_prod, kind)
3 VALUES
4 ('T_601', 'Yojimbo', 106, '1961-06-16', 'Drama');
1INSERT INTO joke(joke_text, joke_date, author_id)
2VALUES (‘Humpty Dumpty had a great fall.’, ‘1899–03–13’,
3 (SELECT id FROM author WHERE author_name = ‘Famous Anthony’));
1INSERT INTO table1 (col1, col2) VALUES (3, 'A string');
2INSERT INTO table1 (col1) VALUES (3); -- col2 will be NULL if allowed
3INSERT INTO table1 VALUES (3, 'A string'); -- all table1 columns
4INSERT INTO table1 (col1, col2) SELECT value3, value1 FROM table2;
1INSERT INTO table_name (a, b) VALUES (val1, val2);
2INSERT INTO table_name (a, b) VALUES (val1, val2), (val3, val4); -- 2 rows
3
4-- From a query:
5INSERT INTO table_name (a, b)
6 SELECT val1 AS a, val2 AS b
7 FROM source_table s
8 WHERE s.val1 >= 10;