Is there a good way to select a row where the key represents the lower bound of a range? I am designing some tables and a number of the tables have as the key a lower and upper bound which never overlap. I want to query by a value that can fall withing any of those ranges. If I keep both columns I can query it as a range (i.e. WHERE lower_bound &lt;= val AND val &lt; upper_bound) and it is fairly simple.

However, if I can reduce the lower and upper bound columns into a single column then the table will be simplified in terms of the amount of data we need to store.

Here is an example of the data to be stored:


    lower_bound | upper_bound | stuff1_lower | stuff2_lower | stuff1_upper | stuff2_upper
    ------------+-------------+--------------+--------------+--------------+--------------
              0 |          10 |        0.222 |        0.333 |        0.444 |        0.555
             10 |          15 |        0.444 |        0.555 |        0.666 |        0.777


The stuff1_lower and stuff1_upper represent the same data, but the value is at the ends of the range. Anything in between I need to interpolate given the bounds. 

For example, I query with 10 and I need the values 0.444 and 0.555 for my application. If I query with a 5 I need the values 0.333 and 0.444, which are the interpolated values.

The data I'm storing though is duplicated both in the key (the bounds) and in the data. By simplifying the table I know that the complexity of the query would increase, but I'm okay with that so long as the speed efficiency isn't significantly impacted.

Is this a good idea? And is there a way to do this (such as through a view) that wont significantly impact efficiency?

UPDATE
Since my data is small I decided to reduce the number of columns as I had been thinking and go with the following query to get the data:
There's no single right answer for any performance question.  The answer is always that query optimizers are very smart, to a point.  So the most efficient design or query will depend on the number of records, what kind of indexes you have, how selective they are, and many, many more factors.

If you want to avoid keeping both bounds of your ranges, you can search using TOP 1 and order by lower_bound but I wouldn't expect this to be efficient necessarily.  I'd suggest profiling it this way to see if the performance is acceptable.  

Having an index on lower_bound will probably help, depending on the number of records in your table.