Skip to content
Home

Query by Example (QBE): Visual querying for databases and information retrieval

Query by Example (QBE) is a visual method for constructing database queries. Users manipulate a form-like view of a schema; the system translates those actions into SQL or performs similarity search in IR systems.

Overview

Query by Example (commonly abbreviated QBE) is an approach for creating database queries using a visual, form-based interface rather than writing text-based statements. It presents the user with a screen that looks like a table or schema and lets them indicate the desired selection by filling in fields, marking columns, or clicking on headers. The actions performed in the visual editor are converted behind the scenes into a conventional query language such as SQL so that the database engine can execute them.

Image gallery

1 Image

How QBE works

Typical QBE tools display a representation of tables and columns; users enter example values, constraints, or placeholders to express what they want returned. A generating component or parser translates the completed form into an executable statement. Because the user manipulates a visible schema instead of memorizing syntax, QBE makes common tasks—selecting columns, filtering rows, and expressing simple joins—more accessible to occasional users.

History and context

QBE was developed in the 1970s at IBM as part of research into user-friendly access to data stored in relational databases. Its development ran roughly in parallel with SQL and other early query systems. The design goal was pragmatic: let people who do not write queries regularly retrieve and manipulate data without needing to learn a full textual language. Over time, the ideas behind QBE influenced many graphical query designers and form-based database tools.

Characteristics and typical features

  • Visual schema presentation: displays tables and columns in a grid or canvas so users can point-and-click rather than type.
  • Fill-in templates: entering example values indicates search constraints (for instance, putting "Smith" under a name column to find records matching that value).
  • Automatic translation: the tool generates an equivalent SQL or other query language statement behind the scenes.
  • Support for joins and aggregation: many QBE interfaces provide ways to express joins and simple aggregates, though very complex queries may still require manual SQL.
  • Target audience: aimed at occasional or non-expert users who need ad hoc access to data.

Uses, variations and examples

Elements of QBE appear in desktop database tools, business intelligence front-ends, and web-based query builders. For example, query design grids in end-user database applications let users select tables, drag fields, and define filters visually. Beyond relational data, the term "query by example" is also used in information retrieval to describe searching for documents similar to a supplied example document; that variant typically relies on vector-space representations and similarity metrics rather than SQL execution.

Distinctions and legacy

QBE is not a single standard but a user-interface paradigm and family of implementations. Its principal distinction from raw textual query languages is the shift of complexity from syntax to interaction design: users express intent by demonstrating examples, and the system performs the translation. While powerful for routine tasks, QBE-style tools can hide details that matter for performance or advanced operations. Nevertheless, the approach remains influential: many modern database front-ends and reporting tools still adopt QBE-like components to lower the barrier to data access and exploration.

For further reading, see basic materials about databases, query languages, relational models such as relational databases, historical accounts of early systems at IBM, the role of parsers in query translation (parser), and the information-retrieval meaning of QBE (information retrieval).

Questions and answers

Q: What is Query by Example?

A: Query by Example (QBE) is a database query language for relational databases.

Q: When was QBE developed?

A: QBE was developed at IBM in the 1970s.

Q: Why was QBE developed?

A: QBE was developed for users who only use databases occasionally and do not want to learn a complex language like SQL.

Q: How does QBE work?

A: QBE presents users with a visual schema of the database, which they edit with a special editor. A parser then translates their actions into a query in a regular query language like SQL, which is executed behind the scenes.

Q: How does QBE improve productivity?

A: With QBE, users can select tables and columns more quickly, for example by clicking on them, rather than typing their names.

Q: What is the context of QBE in information retrieval?

A: In the context of information retrieval, QBE allows users to submit a document and ask for similar documents to be retrieved from a document database using a similarity search based on comparing document vectors.

Q: Which databases systems have front-ends that resemble QBE today?

A: Today, many database systems have front-ends that resemble QBE.

Author

AlegsaOnline.com Query by Example (QBE): Visual querying for databases and information retrieval

URL: https://en.alegsaonline.com/art/80505

Share

Sources