Skip to content
Definition
Query by Example (QBE) is a visual method of querying databases where users fill in example values in a table template to specify what data they want.
Key Point
QBE Characteristics:
• Visual interface - no need to learn SQL syntax
• Fill in values in a grid/table format
• Criteria entered in same row = AND
• Criteria entered in different rows = OR
• Check boxes select which fields to display
Worked Example
QBE Example

Query: Find all Year 12 students studying Computer Science
FieldStudentIDNameYearCourse
Show☑☑☐☐
Criteria12CompSci
How to read this:
• Row criteria: Year = 12 AND Course = 'CompSci'
• Show ticked for StudentID and Name only
• Result shows StudentID and Name of matching records

For OR conditions, use multiple rows:
FieldYearCourse
Criteria Row 112
Criteria Row 2Maths
This finds Year 12 students OR students studying Maths
Exam Tip
Exam Comparison: SQL vs QBE
FeatureSQLQBE
User interfaceText commandsVisual grid
Learning curveSteeperEasier for beginners
FlexibilityVery flexibleLimited but intuitive
PrecisionExact syntax requiredVisual selection
Use caseProgrammers, power usersEnd users, simple queries