MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET [英] MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET

查看:38
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆