Query by Example (QBE) is a method of query creation that allows the user to search for documents based on an example in the form of a selected text string or in the form of a document name or a list of documents. Because the QBE system formulates the actual query, QBE is easier to learn than formal query languages, such as the standard Structured Query Language (SQL), while still enabling powerful searches.
To conduct a search for similar documents based on matching text, the user enters or copies selected text into the form search field. This is then passed to the QBE parser for processing. A query is created using the relevant words (common words such as "and," "is" and "the" are ignored by default) and a search is carried out for documents containing them. Because the meaning of the selected text is less precise than a formal query, results may be more variable than those in a formal query entry.
To conduct a search for similar documents based on full document text, the user submits documents or lists of documents to the QBE results template. The QBE parser performs an analysis of these and formulates a query to submit to the search engine, which in turn conducts a search for similar material.
In terms of database management system, QBE can be thought of as a "fill-in-the blanks" method of query creation. The Microsoft Access Query Design Grid is an example. To conduct a search for field data matching particular conditions, the user enters criteria into the form, creating search conditions for as many fields as desired. A query is automatically generated to search the database for matching data.