MYSQL: Sequential Number Table(MYSQL:序号表)
问题描述
我正在尝试获取从 1 到 2000 万的序列号表.(或 0 到 2000 万)
I am trying to get a sequential number table from 1 to 20 million. (or 0 to 20 million)
对于这个常见问题获得与 MySQL 兼容的解决方案是多么困难,我感到非常震惊.
I am rather awestruck at how difficult it's been to get a MySQL-compatible solution to this common problem.
与此类似:创建一个数字表"在 MySQL 中
但答案只有 100 万.我不太了解位移计算.
But the answer only goes to 1 million. I am not really understanding the bit shift calculations.
我看过很多 SQL 答案,但大多数都是针对非 MySQL 的数据库,所以由于缺乏对 MySQL 和其他方面的了解,我无法采用这些代码.
I've seen many SQL answers but most are for databases that aren't MySQL, so I can't adopt the code due to lack of knowledge of both MySQL and the other.
一些参考资料:
SQL,数字辅助表
什么是最好的方法创建和填充数字表?
请确保您发布的代码在 MySQL 中兼容并且以分号分隔,以便我可以在 PhpMyAdmin 中运行它.我希望将表命名为 numbers
并带有名为 i
Please make sure the code you post is compatible in MySQL and is semicolon delimited so I can run it in PhpMyAdmin. I'd appreciate the table to be named numbers
with the column called i
我将对每个解决方案进行基准测试,以便将其存档,并希望在下次有人尝试搜索此问题时显示出来.
I will benchmark each solution, so the it's archived and hopefully will show up for the next time someone tries to search for this problem.
到目前为止的基准:
时间以秒为单位.
推荐答案
这篇关于MYSQL:序号表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!