I would like to know if it is possible to insert multiple values in an INSERT statement with something like this:
INSERT INTO myTable VALUES ( constant , ARRAY(multipleValues) );
If this is not possible, I will use a stored procedure. My question is more for curiosity than for real purpose, since I’m using a working loop which inserts records once at a time and that does the job.
MySQL does not have an array data type. In order to pass an array from your application code into a MySQL query, you will need to explode it into a string.
You can then do:
Or:
Generally the first form is more concise, however the second form may be more useful if there is a large number of constant columns.