Tuesday, 7 August 2018

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


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

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

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

And what about performance of these two?

Answers:
-----------

both syntaxes are equivalent. The first is SQL standard, the second is MySQL's extension.
So they should be exactly equivalent performance wise.
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.


How do you INSERT multiple values using INSERT INTO table SET? Is this even possible?

Can you please comment regarding this.


0 comments:

Post a Comment