Examples for business, study, careers, love, and more...
Examples :: MYSQL Examples :: Example of Insert Mysql Statement

Example of Insert Mysql Statement:

INSERT INTO employees(name,salary) VALUES('anthony','2000')

INSERT INTO employees(name,salary) VALUES('anthony',NULL)

INSERT INTO temp_table(name,salary) SELECT name,salary FROM employees WHERE salary > 2000

Example of Mysql Insert


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] ... ]

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] ... ]

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO]
tbl_name [(col_name,...)]
SELECT ...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]