Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert Set or Insert Values [duplicate]

Tags:

sql

mysql

INSERT INTO `table` VALUES ('val1','val2','val3')

INSERT INTO `table` SET a='val1',b='val2',c='val3'

Both are used for the same purpose.but which i should use? in which case? and why?

like image 836
Petru Lebada Avatar asked Apr 29 '26 20:04

Petru Lebada


1 Answers

They are identical, but the first one is standard SQL. As the SQL parser treats them as synonyms there is no difference in performance, usage or anything. As always, prefer using the standardized form, the first syntax in this case, for portability and compatibility.

Refer to the SQL-92 standard syntax.

like image 194
Niels Keurentjes Avatar answered May 01 '26 11:05

Niels Keurentjes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!