Category: 

What Is a Range Query?

Article Details
  • Written By: Kristie Lorette
  • Edited By: O. Wallace
  • Last Modified Date: 21 August 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In late 19th-century London, mail was delivered to residential addresses up to twelve times each day.   more...

September 28 ,  1924 :  Two US military planes complete the first flights around the world.  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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}