Generating integer sequences (e.g. all numbers between 20 and 100) in MySql is much harder than it needs to be. Other DBMS products have had such support for quite awhile. In PostgresSql, you can do something like so: SELECT * FROM generate_series(1, 6) number That will generate a table of numbers from 1 to 6. Seems like basic functionality right? Not in glorious MySql. You have several options but they are either hacky or require a fair amount of work.