PHP/MySQL – correct use of INSERT query

For all PHP/MySQL developers, there are two ways of using INSERT query:

1. INSERT INTO [table] VALUES (‘value-1′,’value-2’);

2. INSERT INTO [table] (‘column-1′,’column-2’) VALUES (‘value-1′,’value-2’);

Always use INSERT variant 2, because in case you need to add more columns to the database, you won’t need to change the PHP code for the query to work.

The unspecified columns will take default value, defined when appending the new column.