Internet
Fact-checked

At WiseGEEK, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Is a Range Query?

Kristie Lorette
Kristie Lorette

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.

Woman doing a handstand with a computer
Woman doing a handstand with a computer

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.

Discuss this Article

Post your comments
Login:
Forgot password?
Register:
    • Woman doing a handstand with a computer
      Woman doing a handstand with a computer