I\'m using Postgres, and I have a large number of rows that need to be inserted into the database, that differ only in terms of an integer that is incremented. Forgive what
Afaik, you can't write a loop directly as SQL, you'd have to create a stored procedure to do it.
This will do though (but someone can probably make it cleaner)
INSERT INTO articles WITH RECURSIVE i AS ( SELECT 1 x UNION ALL SELECT x + 1 FROM i WHERE x < 10000000 ) SELECT x FROM i;