title: Get data from specific column(sqlite database) to perform calculation and store it back in netbean
body: <p>I have a database table called delegateeinfo.
  I want to retrieve values from 3 column that is Username, Duration and EndDate.
  The purpose of retrieving this value is to perform date-time calculation to check how much holiday duration left and update into the database. 
  But I can't retrieve all data from the table, I only able to get the first row. Any idea how to get all data to perform calculation and update it back?
  I tried so search many but still can't get the solution.
  Below here are some example of my code:</p>
  
  <pre><code>try{
          String sql = "select Username,EndDate,Duration from delegateinfo";
          pst = connection.prepareStatement(sql);
          rs=pst.executeQuery();
          if(rs.next()){
  
              String name = rs.getString("Username");
               String enddate = rs.getString("EndDate");
                String duration = rs.getString("Duration");
  
  
               LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
               DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
      LocalDateTime convertEnd = LocalDateTime.from(LocalDate.parse(enddate, formatter).atStartOfDay());
  
       Duration g = Duration.between(today, convertEnd);
           if(g.isNegative()){
          System.out.println("Delete user from database since holiday duration is ended.");
      }else{
          System.out.println("The user still have " +g.toDays()+ " days remaining, update into database");
      }
  
  
  
          }
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
  
      } 
  </code></pre>