INSERT into customers
VALUES(null,
'Mike','HaiDian Distinct','Beijing',
'CN','100876','China',null,null);
INSERT into customers(cust_name,
cust_address,cust_city,cust_state,cust_zip,
cust_country,cust_contact,cust_email)
VALUES('John','Xiafei LU','Shanghai',
'CN','666666','China',null,null);
如果表的定义允许,则可以在 insert
操作中省略某些列。省略的列必须满足一下某个条件:
null
值INSERT into customers(cust_name,
cust_address,cust_city,cust_state,cust_zip,
cust_country)
VALUES('Jenny','AAAA','Shanghai',
'CN','77777','China'),
('Herry','BBBB','Beijing','CN','88888','China');
INSERT into customers(cust_name,
cust_address,cust_city,cust_state,cust_zip,
cust_country)
SELECT cust_name,cust_address,cust_city,cust_state,cust_zip,
cust_country FROM custnew;
insert
和 select
中的列名不一定非要相同