title: Fastest way to see if a number is between two values
body: <p>I'm using Spring+JPA</p>
  
  <p>I have a table which has MIN_VALUE and MAX_VALUE.</p>
  
  <p>I then have a service that has a input VALUE. What is the fastest/better way to know if the the VALUE is between MAX AND MIN VALUES?</p>
  
  <pre><code>@Autowired
  private ValuesRepository valuesRepository;
  
  public void calculateValue(double value) {
      List&lt;Values&gt; valuesList = valuesRepository.findAll();
      // ??
  }
  </code></pre>
  
  <p>Edit Maybe is better to do the select already returning one row??</p>
  
  <pre><code>public interface ValuesRepository extends JpaRepository&lt;Values, Long&gt; {
  
      public Values // ??
  }
  </code></pre>