MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET

MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET(MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET)
本文介绍了MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

INSERT INTO table VALUES ..INSERT INTO table SET 的主要区别是什么?

What is main difference between INSERT INTO table VALUES .. and INSERT INTO table SET?

示例:

INSERT INTO table (a, b, c) VALUES (1,2,3)

INSERT INTO table SET a=1, b=2, c=3

那两人的表现呢?

推荐答案

据我所知,两种语法是等效的.第一个是SQL标准,第二个是MySQL的扩展.

As far as I can tell, both syntaxes are equivalent. The first is SQL standard, the second is MySQL's extension.

所以它们在性能方面应该完全相同.

So they should be exactly equivalent performance wise.

http://dev.mysql.com/doc/refman/5.6/en/insert.html 说:

INSERT 将新行插入到现有表中.语句的 INSERT ... VALUES 和 INSERT ... SET 形式基于显式指定的值插入行.INSERT ... SELECT 表单插入从另一个表或多个表中选择的行.

INSERT inserts new rows into an existing table. The INSERT ... VALUES and INSERT ... SET forms of the statement insert rows based on explicitly specified values. The INSERT ... SELECT form inserts rows selected from another table or tables.

这篇关于MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)