K
I was not very sure of that and I have moved a little on the subject by reaching the following conclusions:-I've tried to enter strings using simple quotes. ' ' in columns waiting for a int. When inserting a null value as in your case ''; the insert was made but one exception jumped: Even so, looking at the table automatically entered the value 0.When you enter a number in quotation marks '2' the number was correctly entered in the table despite indicating that it is a string. Explanation: By default the SQL format would not accept it, however there are exceptions like MySQL, Oracle, etc that accept this type of syntax. When you put the quotes, the value entered inside is interpreted as a String and in particular cases such as those mentioned, before the query MySQL is executed automatically try to change the format of String a IntThe problem with this is that you can give several results: Runs correctlyMakes mistake and does not run queryThe number is interpreted and the result is different from the introduced(change to other numbers, the quotes move, the value changes,etc)Therefore it is not highly recommended to use this method not only by interpretation but also because at a minimum it increases the burden of consultation by simply putting 2 quotation marks. RecommendSQL is prepared to react to each type of data in a different way. It is not recommended to never put quotes around numbers in the same way that not put numbers in places where a String or Boolean, each type of data has its characteristics and is interpreted differently to optimize the operation.The query can run it in the following ways:By directly placing a number 0 in the value:insert into usuarios.comida(codigo, usuario, codbinsa, fecha, invitado, pedido, hora)
values ('1cb1e6c756', 0300, '0300', '2018-02-05', 0, 'Paella Habas Alcachofa. MERLUZA PLANCHA. Couland. |', '0950');
Putting a value NULL:insert into usuarios.comida(codigo, usuario, codbinsa, fecha, invitado, pedido, hora)
values ('1cb1e6c756', 0300, '0300', '2018-02-05', NULL, 'Paella Habas Alcachofa. MERLUZA PLANCHA. Couland. |', '0950');
Or simply not indicating that you will introduce that value and let the value be defaulted (my recommendation)insert into usuarios.comida(codigo, usuario, codbinsa, fecha, pedido, hora)
values ('1cb1e6c756', 0300, '0300', '2018-02-05', 'Paella Habas Alcachofa. MERLUZA PLANCHA. Couland. |', '0950');
Sources: https://stackoverflow.com/questions/6781976/mysql-quote-numbers-or-not https://www.sigmainfy.com/blog/sql-single-quotes-for-numeric-values-is-it-really-good-practice.html