What is the best way to insert with SQL?

5

I say this because there are two ways, so I understood.

You have the:

INSERT INTO teste SET nome = "Lucas", sobrenome = "Alves";

And also the way:

INSERT INTO teste (nome, sobrenome) VALUES ("Lucas", "Alves");

Question of speed, good practices, etc., has anything to do, or is it all the same?

    
asked by anonymous 03.09.2017 / 04:57

1 answer

4

The first form works in MySQL and derivatives, but not in other databases.

The second form is the default form that should work across all databases.

See here in SQLFiddle.

    
03.09.2017 / 05:03