A query is any statement passed by a computer program to locate and retrieve information.
Think of a query as a question. A query is any question posed of a data set by a computer program. When you query for information you are asking a computer program to locate and reveal any data that match the terms included in the query.
Queries are used extensively on the web. The most obvious example is a search engine such as Google. However, queries come into play on any website or web-enabled service that includes a search prompt. There at least three key components that come into play any time a query is made on the web:
- Query language: Information in a computer database must be stored according to a very specific format in order for it to be useful. In order to locate information in a database, a query must be made using the right language. Query languages may be classified as either database query languages or as information retrieval languages. Database query languages are very specific, and must be phrased and formatted perfectly in order to return the desired results. Information retrieval languages, on the other hand, are much more flexible and attempt to locate any records relevant to the terms of the query.
- Query string: When a query is made, the query is converted into a specifically formatted string. The query string must be formatted correctly if it is to be understood. In the case of a query made over the web, the string is typically appended to the website URL and passed back to the web server which interprets the combined URL and query string, performs the query, and returns the relevant results.
- Web search query: A web search query takes place when a database is queried over a web-based interface. The most common example is that of a general purpose search engine such as Google. However, web queries can be made of any Internet-connected database for which a web-based interface has been implemented.
Frequently Asked Questions
What are some common query languages?
Some of the most common query languages are those used by dynamic websites and those used by search engines:
- SQL: MySQL and PostgreSQL are two of the most common relational database management systems designed to be search using the SQL query language. SQL is the query language used by the majority of content management systems used to serve up dynamic websites and commercially available website development platforms.
- Search engine query languages: Search engines, including Google and Bing, have developed proprietary search engine query languages designed to produce the most powerful search functionality and the most relevant results possible.
On a daily basis, most web users interact with SQL and search engine query languages. However, there are dozens of other query languages designed for a wide variety of purposes and applications.
How are queries used in applications other than search engines?
A query occurs any time a search function is used to locate records in a database. So on a PC when you use the search prompt in Windows Explorer to find a file on your computer, you’ve just passed a query. When you type in an account number to pull up a customer account at work, a query was used to locate the record. Queries are a part of the fundamental functionality of the web and all computer systems.