arrow
Return

QA-SQL: query-augmented SQL generation using few-shot prompting with data augmentation

delete2026-02-11
delete0
PRE
AI
S
Sokheang Chan
V
Vungsovanreach Kong
A
Anand Nayyar
T
Tae-Kyung Kim *
DOI:10.7717/peerj-cs.3525delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Natural Language to Structured Query Language (NL-to-SQL) models make it easier to retrieve data from structured databases by converting plain language queries into Structured Query Language (SQL) commands. However, current methods often struggle with complex database structures, unclear user questions, and generating efficient SQL queries. These issues make it hard to use them effectively in real-world, large-scale databases. To tackle these problems, a novel framework titled Query-Augmented SQL Generation (QA-SQL), is introduced that combines retrieval augmented generation (RAG) with data augmentation with advanced techniques to enhance the accuracy and efficiency of natural language to SQL (NL-to-SQL) generation. The proposed approach uses Schema Linking, RAG, and Dynamic Prompt Engineering along with few-shot learning and vector database retrieval, to enhance SQL query generation through query augmentation. To test and validate the proposed model, extensive experimentations were conducted on the BIg Bench for LaRge-scale Database Grounded Text-to-SQL Evaluation (BIRD) benchmark, which includes 1,534 natural language queries across various relational databases and the results highlighted a execution accuracy of 46.68% and a valid efficiency score of 87.66%, outperforming existing methods. The proposed research introduces a context-aware retrieval system that significantly enhances SQL accuracy, paving the way for more scalable and reliable NL-to-SQL solutions.
Keywords:
Text-to-SQL
Retrieval-augmented generation
Data augmentation
Large language models

Journal

PeerJ Computer Science cover
PeerJ Computer Science
IF:
2.5
Papers:
3.4K
Citations:
6.9K

Organization

D
Duy Tan University
Scholars:
495
Papers: 355
Citations: 6.6K
C
chungbuk national university
Scholars:
1.7K
Papers: 729
Citations: 0
Cited Papers

Cited Papers

err
IF0
err
err0
errOAAI
err
errShare
errSave
err
IF0
err
err0
errOAAI
err
errShare
errSave
ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems
err2024-03-05
err0
errOAAI
errYi Zhang; Jan Deriu; George Katsogiannis-Meimarakis; Catherine Kosten; Georgia Koutrika; Kurt Stockinger
errShare
errSave
err
IF0
err
err0
PREAI
err
errShare
errSave
Next-Generation Database Interfaces: A Survey of LLM-Based Text-to-SQL
err2025-09-12
err0
PREAI
errZijin Hong; Zheng Yuan; Qinggang Zhang; Hao Chen; Junnan Dong; Feiran Huang; Xiao Huang
errShare
errSave
researcher View more