如何在 postgresql 中创建十进制序列?
我想做的是用如下数据填充表格:
| thickness | length | width |
|: 0.02 |:1:| 1:|
|: 0.02 |:1:| 2:|
|: 0.04|:1:|1:|
|: 0.06|:1:| 1:|
本质上,我需要以 0.02 的增量从 0 填充到 10
我的宽度和长度列同样需要从 1 填充到 144增量为 0.02
这是大量行,希望自动填充它,而不是手动全部输入。不幸的是,我只能让序列作为整数工作,并且我希望它们按小数递增。
What I'm trying to do is populate a table with data such as follows:
| thickness | length | width |
|: 0.02 |:1:| 1:|
|: 0.02 |:1:| 2:|
|: 0.04|:1:|1:|
|: 0.06|:1:| 1:|
Essentially I have a column thickness that I need populated from 0 to 10 in increments of 0.02
My Width and Length columns similarly need to be populated from 1 to 144 in increments of 0.02
This is large number of rows and would like to populate it automaticly instead of typing this all out by hand. Unfortunately I could only get the sequence to work as integers, and I would like them to increment by decimals.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在两个
generate_series()
调用之间使用交叉联接You can use a cross join between two
generate_series()
calls