What Is a Range Query?

Article Details
  • Written By: Kristie Lorette
  • Edited By: O. Wallace
  • Last Modified Date: 11 October 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
U.S. companies first sold energy drinks in the early 1900s; they contained radium, which causes radiation sickness.  more...

October 19 ,  1987 :  The Dow Jones experienced its second-largest percentage drop in history.  more...

Range query is a term used in database management that describes the lower and upper limits for conducting a search of the information the database contains. In fact, a range query is a common practice for the use of a database that contains information for a business, organization or other informational purpose.

For example, a doctor’s office may have a computer database system for its patient files. In a case where the doctor’s office wants to send a postcard in the mail to patients that are due for an annual check-up, the database administrator would use a range query to identify the records that fall within the criteria. The lower range may be patients that were last in the office on 25 May of the year before last. The upper range would be patients that were last in the office on 25 May of the previous year.

A range query does not always have to pertain to dates. The range variable can vary from search to search. What all of the searches have in common, however, is that the database administrator or person using the database to find the information, does not know how many records or files fall within the range.


For example, a company that sells widgets may track the amount of each purchase for each client record in its database. So, when Susie Q makes a purchase of $4,000 US Dollars (USD) in January, $2,000 USD in March, $3,500 USD in June and another $4,000 USD in October, all of these purchase amounts are recorded in Susie Q’s record in the database. If the company wants to launch a marketing campaign to reward loyal customers, they may use a range query to search the database for customers that have purchased more than $12,000 USD of widgets from them in the past year.

For this query, they would enter $12,000 in the lower end of the range query and $12,001+ in the upper range field of the search. An additional variable would be the date range of one year. The results returned would include Susie Q’s record.

Another instance where a range query would come in handy is if the company is searching for customers that ordered at least four times in a one year period. The range query on the order amounts would have a lower end of 4 and an upper end of 5+. Another variable would be the dates so a range query of a one year period would be entered into the search criteria of the database.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?