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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET


基础教程推荐
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01