3.2.1 INSERT

3.2.1.1 Syntax

INSERT [INTO] tbl_name

[(col_name,...)]

{VALUES | VALUE} ({expr },...),(...),...

[ ON DUPLICATE KEY UPDATE

col_name=expr

[, col_name=expr] ... ]

OR

INSERT [INTO] tbl_name

SET col_name={expr | DEFAULT}, ...

[ ON DUPLICATE KEY UPDATE

col_name=expr [, col_name=expr] ... ]

3.2.1.2 举例

insert into test (col1,col3) values(1,'cust1'),(2,'cust2');
insert into test (col1,col3) values(default,'cust3');
insert into test set col1=4,col3='cust4';
insert into test set col1=default,col3='cust5';
insert into test (col1,col3) values(default,cast(now() as char));

3.2.1.3 限制

  • 在插入ER关系的子表时,每个语句之允许插入一个ROW

  • 全局序列在插入时不允许指定值,全部由dble序列生成

results matching ""

    No results matching ""