MySQL必知必会第十九章
第十九章--插入数据
1。插入数据:
insert into customers values(NULL, "XXX","XXX", "XXX","XXX", "XXX","XXX", "XXX","XXX",NULL, NULL);
没有输出 INSERT语句一般不会产生输出.
各个列必须以它们在表定义中出现的 次序填充。
第一列cust_id也为NULL。这是因为每次插入一个新行时,该 列由MySQL自动增量。
2.编写insert语句
insert into customers(cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
values("XXX","XXX", "XXX","XXX", "XXX","XXX", "XXX","XXX");
3.如果不提供列名,则必须给每个表列提供 一个值。如果提供列名,则必须对每个列出的列给出一个值
4.提高整体性能,
insert low_priority into ...;(降低insert语句的优先级)
5.批量插入
执行多条insert语句,或者一条insert语句多个值
6.插入检索出的数据
insert into customers(cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
values(select cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email from custnew);
INSERT SELECT中SELECT语句可包含WHERE子句以过滤插入的数据。
以上是 MySQL必知必会第十九章 的全部内容, 来源链接: utcz.com/z/533121.html