0

I would like to do something as:

SELECT ROWNUM FROM ALL_OBJECTS
WHERE ROWNUM <= 100000

Which large table do we have in MysQL?

Marcel
  • 2,810
  • 2
  • 26
  • 46
  • And for those unfamiliar with oracle what does this do? – P.Salmon Oct 01 '16 at 13:54
  • I don't think MySQL has any table that has 100,000 rows by default. – Gordon Linoff Oct 01 '16 at 13:54
  • Do you know a smaller table, @GordonLinoff? Which is the size? – Marcel Oct 01 '16 at 13:56
  • It will just show all numbers between 1 and 100000, @P.Salmon. – Marcel Oct 01 '16 at 13:57
  • In general you shouldn't count on the existence of a large table to get a sequence of numbers. In Oracle I'd usually use something like `SELECT LEVEL N FROM DUAL CONNECT BY LEVEL <= 10` to get numbers from 1 to 10. There are many other ways to accomplish this - see [this ORAFAQ article](http://www.orafaq.com/wiki/Oracle_Row_Generator_Techniques) for examples. Also, see [this answer](http://stackoverflow.com/a/904110/213136) for a MySQL solution. Best of luck. – Bob Jarvis - Слава Україні Oct 02 '16 at 04:20
  • I'm seeing the answer... How many rows does "some_table" have? It could be just 1 row, right? In this case, it will not work. But forget it. MySQL sucks... – Marcel Oct 02 '16 at 04:53

1 Answers1

0

Yes, there is. Look at INFORMATION_SCHEMA, pick the largest table in there.

Documentation here: http://dev.mysql.com/doc/refman/5.7/en/information-schema.html

But I must say that this is a very clunky way of producing a long sequence of numbers. There may be better ways, but you are not going to receive them with this question, because you have not really asked a question, you have asked an answer. You might want to ask a question instead, beginning by explaining what it is that you want to achieve, instead of coming up with a wacky idea about how to achieve it, and asking how to implement your wacky idea.

Mike Nakis
  • 56,297
  • 11
  • 110
  • 142