请教使用SQL如果数据库里有很多数据, 由于内存有限, 每次我只取固定数目的数据, 比如每次取100行, 下一次再取接着的100行, 应该怎么写? 谢谢.
table name: table
Select name from table
?
?
?
这个问题挺有意思,我们研究研究
如果你不能改变table schema的话, 我想只能选取100行,而接着的100行就不能选. 我想你用的是JDBC driver. Statement class 里有个 setFetchSize(int rows) method, 你可以设rows 为100 in your case.
如果你能改变database table schema 的话, 你可以给那个table 多加一个 column是row 的index. 这样每次你选index从当前值到增加100, 然后更新当前index值.
你试试.:)
如果你能改变database table schema 的话, 你可以给那个table 多加一个 column是row 的index. 这样每次你选index从当前值到增加100, 然后更新当前index值.
你试试.:)