hi.
for debug test, i need store 200 random numbers in the database
I obviously want to avoid insert one by one
how i can do that? (mysql)
i discover this, but is not what i pretend.
UPDATE tablename SET column1 = (rand() * 50)
hi.
for debug test, i need store 200 random numbers in the database
I obviously want to avoid insert one by one
how i can do that? (mysql)
i discover this, but is not what i pretend.
UPDATE tablename SET column1 = (rand() * 50)
do it with php
pseudo-code:
loop=0;
while loop < 200 {
INSERT INTO daTable (daColumn) VALUES ( {$rand(something)} )
loop += 1;
}
You’ll have to have a little bit more than just a single query to insert the data
INSERT INTO table (col1, col2) VALUES (1, RAND()), (2, RAND()) etc but you’ll still need to put a little effort in to fill it.
did my example use single query? not it did not, i thought it was pretty clear that it should be 200 queries
That wasn’t aimed at you… it was a reply to the OP.
However, I also suggested a slight variation of building it into a larger query rather than 1 row per query