Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk2 min

Definition of Query by Example (QBE)

Query by Example lets users describe what they want by filling example values into table skeletons. Here is the classic definition, how it compares with SQL, and how modern frameworks reuse the name.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“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.

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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.