Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
整数の間隔でダービーデータベースから選択するにはどうすればよいですか? for cycle を使用して int をインクリメントし、間隔からすべての int に対してデータベースからレコードを選択しようとするよりも効果的に実行できますか? ありがとう
次のようなクエリで実行できます。
select * from mytable where some_column between ? and ?
Derby は JDBC と SQL を使用するため、変数のプレースホルダー (疑問符) を使用してクエリを作成し、実行時に値を指定してquery.setInt(1, 3) 、query.setInt(2, 7)たとえば 3 ~ 7 (両端を含む) の範囲を取得できます。
query.setInt(1, 3)
query.setInt(2, 7)