Related Experiment Video
Updated: Jan 20, 2026

Executing Complexity-Increasing Queries in Relational MySQL and NoSQL MongoDB and EXist Size-Growing ISO/EN 13606 Standardized EHR Databases
Published on: March 19, 2018
Explaining Wrong Queries Using Small Examples
Zhengjie Miao1, Sudeepa Roy1, Jun Yang1
1Duke University.
This study introduces algorithms to find the smallest database counterexamples, explaining why SQL queries differ. This helps identify errors in query equivalence, crucial for database education and performance tuning.
Area of Science:
- Computer Science
- Database Systems
- Artificial Intelligence
Background:
- Evaluating SQL query correctness is vital in database education and performance analysis.
- Standard methods involve comparing query outputs on test databases, but counterexamples can be overly complex.
- Identifying the root cause of query inequivalence requires understanding these counterexamples.
Purpose of the Study:
- To develop algorithms for finding the smallest database counterexample (D') given a larger counterexample (D) for two SQL queries (Q1 and Q2).
- To address the NP-hard problem of minimizing counterexamples for SQL query inequivalence.
- To provide practical tools for database education and query optimization.
Main Methods:
- Developed a suite of algorithms for finding minimal counterexamples across various query classes.
- Introduced a provenance-based algorithm utilizing constraint solvers for Select-Project-Join-Union-Difference (SPJUD) queries.
- Extended the approach to handle complex queries involving aggregation, group-by, and nested structures.
Main Results:
- Demonstrated effectiveness and scalability of the proposed algorithms on student assignments and TPC-H benchmark queries.
- Successfully reduced complex counterexamples to minimal, understandable instances.
- Validated the tool's utility in an undergraduate database course through a user study.
Conclusions:
- The developed algorithms efficiently find minimal counterexamples, aiding in understanding SQL query inequivalence.
- The provenance-based approach offers a scalable solution for complex query types.
- The tool effectively supports database education by clarifying query comparison and relational algebra concepts.
More Related Videos
05:47Evidence-based Knowledge Synthesis and Hypothesis Validation: Navigating Biomedical Knowledge Bases via Explainable AI and Agentic Systems
Published on: June 13, 2025
10:02Event Related Potentials ERPs and other EEG Based Methods for Extracting Biomarkers of Brain Dysfunction: Examples from Pediatric Attention Deficit/Hyperactivity Disorder ADHD
Published on: March 12, 2020
Related Concept Videos
Newton's Third Law: Examples
Free Body Diagrams: Examples
Kinetic Molecular Theory and Gas Laws Explain Properties of Gas Molecules
Scientific Laws and Theories
The Nitrogen Cycle
Proteins: From Genes to Degradation
Transcription is the synthesis of RNA...