Reputation:
Okay so I'm really new to SQL and I am using mySQL Workbench. I found some code that works for me but from what I've read on w3schools I didn't not see it. The code is INSERT INTO servers SET ?
(where servers is the table). But I have read INSERT INTO servers
is there any actual difference between these two? Is any of them preferred? What does the SET ?
mean?
Upvotes: 0
Views: 407
Reputation: 1270713
The preferred -- or at least standard -- method is:
insert into servers ( . . . )
followed by either values
or select
. The columns being updated are in the parenthesis.
MySQL has extended this syntax. It follows the same convention as update
. The set
syntax makes it easier to see what value is being assigned to which columns. That is definitely an advantage. But working against the syntax is the simple fact that it is not standard.
If you are learning SQL, learn the standard syntax and remember to always list the columns.
Upvotes: 1