I need to get a result set containing the first N positive integers. Is it possible to use only standard SQL SELECT statement to get them (without any count table provided)?
If it’s not possible, is there any specific MySQL way to achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Seems that what you want is a
dummy rowset.In
MySQL, it’s impossible without having a table.Most major systems provide a way to do it:
In
Oracle:In
SQL Server:In
PostgreSQL:MySQLlacks something like this and this is a serious drawback.I wrote a simple script to generate test data for the sample tables in my blog posts, maybe it will be of use:
You call the procedure and the table gets filled with the numbers.
You can reuse it during the duration of the session.