Recommended Free Tools
Query by Example (QBE) is a way of querying a database by showing the system an example of what you want instead of writing a conventional query. In the classic database sense, you fill example values into a table-like skeleton, and the system interprets those entries as a query. The name is also used today for programming APIs that build queries from example objects, and those work differently.
The classic meaning: a query language for non-programmers
Moshé M. Zloof introduced QBE at IBM. The abstract of his 1975 paper, published in the VLDB proceedings and recorded by IBM Research, says: “Query-by-Example is a query language for use by non-programmers querying a relational data base.” The central idea is that the user describes a desired record or set of conditions through examples, rather than composing a textual query.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Concepts of Database Management (MindTap Course List) | $69.76 | Buy on Amazon |
| 2 |
|
Concepts of Database Management | $45.99 | Buy on Amazon |
| 3 |
|
Database Systems: The Complete Book | $184.50 | Buy on Amazon |
| 4 |
|
Database Management Systems | $432.87 | Buy on Amazon |
| 5 |
|
Database Systems: Design, Implementation, & Management (MindTap Course List) | $90.36 | Buy on Amazon |
As an Amazon Associate I earn from qualifying purchases.
How classic QBE works
Classic QBE uses skeleton tables that correspond to the relations (tables) in the database. The user enters values or variables in those skeletons. Those entries describe the constraints and, where the user marks them, the output to return.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
As an illustration (not taken from a specific product), imagine a skeleton for an Employees table with columns Name, Department and Salary. Typing “Sales” under Department and marking the Name column for output asks for the names of employees in Sales. A variable shared between two skeleton tables expresses a join.
#1 Best Overall
The Ramakrishnan and Gehrke database textbook chapter on QBE explains the language in relation to relational calculus. It also states that, in the system it discusses, QBE queries can be expressed in SQL. Other products may not translate in the same way or support the same features.
More than searching
QBE was not only a retrieval tool. Zloof’s IBM publications describe operations for defining databases and their constraints, and for updating and maintaining data, as well as querying it.
Rank #2
QBE versus SQL
They are different query interfaces onto relational data. QBE is built around filling in a table skeleton, while SQL is a textual language. The textbook notes that QBE is especially suited to queries involving a few tables and can be awkward for complex queries. That is the textbook’s assessment of QBE, not a universal verdict on every product that uses the name.
“Query by Example” in modern software
Several programming frameworks reuse the name for APIs that build queries from example objects. They share the broad idea of expressing constraints through examples, but their rules are product-specific.
Rank #3
Spring Data JPA
Spring Data JPA describes a probe object, which holds the example values, together with an ExampleMatcher that controls how they are matched. Its documentation cautions that string matching support can depend on the database.
jOOQ
jOOQ offers a simpler example-record operation. Fields that are populated become equality predicates, and fields left unset add no condition.
Rank #4
Comparing implementations
| Axis | Classic QBE | Spring Data JPA | jOOQ |
|---|---|---|---|
| Interface | Table skeletons | Probe object plus ExampleMatcher |
Example record |
| How populated fields are read | Values and variables express constraints and requested output | Controlled by the matcher | Equality predicates; unset fields add no condition |
| Database-specific limits | Not stated | String matching can depend on the database | Not stated |
| Relation to SQL | Textbook system translates QBE to SQL | Not stated | Not stated |
Do not assume a capability in one implementation carries over to another. Identify the product before describing its syntax or limits.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




