What’s a Range Query?

Print anything with Printful



Range query is a database management term used to search for information within a specific range of values. It can be used for various purposes, such as identifying patients due for an annual checkup or loyal customers who spent more than a certain amount. The range variable can vary, but the search criteria always include a lower and upper bound.

Range query is a term used in database management that describes the lower and upper bounds for conducting a search of the information contained in the database. In fact, a range query is a common practice for using 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 their patient files. In the event that the practice wants to mail a postcard to patients due for an annual checkup, the database administrator will use a range query to identify the records that fall within the criteria. The lowest range may be patients who were last on the study on May 25 of the previous year. The upper range would be patients who were last in the office on May 25 of the previous year.

A range query doesn’t always have to be about dates. The range variable can vary from search to search. What all searches have in common, however, is that the database administrator or person using the database to find information doesn’t know how many records or files are in range.

For example, a company that sells widgets can track the amount of each purchase for each customer record in its database. Then, 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 can use a range query to search the database for customers who bought more than $12,000 USD worth of widgets from them in the last year.

For this query, they would enter $12,000 in the low end of the range query and $12,001+ in the high range field of the search. An additional variable would be the one year date range. Returned results would include Susie Q’s record.
Another case where a range query would be useful is if the company is looking for customers who have ordered at least four times in any one year period. The order amount range query would have a low bound of 4 and a high bound of 5+. Another variable would be dates, so a range query of a one year period would be entered into the database search criteria.




Protect your devices with Threat Protection by NordVPN


Skip to content