Skip to content
Open access

Evaluation of Large Language Models for Natural Language to SQL Query Generation: A Comparative Study Using Exact Match and Execution Accuracy

Aug 2026 · International journal of computer information systems and industrial management applications · 0 citations

TL;DR

The study empirically demonstrates comparative behaviours of the current LLMs, and suggests the use of execution-aware evaluation in the studies and deployment of Text-to-SQL.

Abstract

Decisions are being made based on data, and the demands for easy-to-use interfaces that enable users to simply type in a question to a relational database without having to be a Structured Query Language (SQL) expert have increased. Although the development of Large Language Models (LLMs) has seen remarkable advancements in the past few years, and has led to the emergence of LLMs that have significantly improved the generation of SQL from natural language (Text-to-SQL)[1], there is a relative lack of systematic comparisons between the latest commercial LLMs that has been tested against a series of graded SQL complexity levels with both syntactic and execution-based metrics. This research aims to assess and contrast ChatGPT, Google Gemini, DeepSeek, and Microsoft Copilot for their accuracy and efficacy in creating SQL queries from natural language queries. In a quantitative experimental design, 100 natural language questions were given using a purpose-built benchmark, with six types of queries that included simple retrieval, filtering, joins, aggregation, GROUP BY and HAVING, and nested subqueries. The results of the models were assessed using the manually written and validated ground truth query, with the use of normalised Exact Match Accuracy (EMA) and Execution Accuracy (EXA). The best overall results (EMA 97%, EXA 97%) were obtained by ChatGPT. The Copilot scored EMA 56% and EXA 96%, DeepSeek EMA 55% and EXA 93% and Gemini the lowest with a score of EMA 36% and EXA 87%. The large margin between EMA and EXA for the models (+51 points, +40 points, +38 points) demonstrates the significant shortcomings of exact-match scoring when it comes to assessing real-world skills for producing valid but structurally different SQL. The study empirically demonstrates comparative behaviours of the current LLMs, and suggests the use of execution-aware evaluation in the studies and deployment of Text-to-SQL.

Read PDF

Similar papers

Natural Language Interfaces for Databases: What Changes for Users?

A mixed-method, between-subjects user study comparing SQL-LLM, a GPT-4o-backed NLIDB, with Snowflake, a traditional SQL analytics platform finds that a verification burden survives the switch to natural language, so an NLIDB that hides the generated SQL would remove the very step users relied on to trust the answer.

Unknown authors · 0 citations
Jul 2026

GPS-Relational: Generative Problem Solving with Relational Databases

Experimental results demonstrate that GPS-Relational constructs executable reference SQL across existing benchmark and complex generated queries, and that LLM execution accuracy degrades significantly as nesting depth increases up to 15 levels.

Goli Vaisi, P. Sheu · 0 citations
Review Open access Aug 2026

Implementation of Chatbot for Generating Natural Language to SQL Queries

This paper explores the practical implementation of a Chatbot designed to connect natural language communication with database interactions by generating Structured Query Language (SQL) queries. Utilizing the OpenAPI framework, a widely-used specification for building APIs, our approach aims to enhance the flexibility and interoperability of the ChatBot. The system not only interprets user queries expressed in natural language but also transforms them into syntactically correct and semantically meaningful SQL commands. This paper provides an overview of the current landscape of natural language processing (NLP) Chatbots, discusses the architecture and design considerations of our implementation, and highlights the methodology for training and fine-tuning using state-of-the-art NLP models. Real-world use cases are presented to showcase the practical applicability of the Chatbot, demonstrating its ability to handle various complexities inherent in natural language queries. This work contributes to the field by presenting a scalable and robust solution that combines NLP and database interactions through the utilization of OpenAPI, with potential implications for improving human-computer interactions within database systems.

R. Santosa, Hartantya Ainiyatuts Tsaniyah, Yoga Ari Tofan et al. · 0 citations
Jul 2026

GGC: Selective Query Correction for Reliable Text-to-SPARQL Generation

Generator-Gate-Corrector (GGC), a framework for reliable LLM-based Text-to-SPARQL generation that enhances the accuracy, reliability, and efficiency of LLM-based text-to-SPARQL generation.

Ziyi Yang, Thanh-Son Nguyen, Tuan Anh Nguyen et al. · 0 citations
#artificial intelligence Preprint Aug 2026

BIRD-History: A Benchmark for History-Driven Text-to-SQL with Fine-Grained Knowledge Annotations

BIRD-History is introduced, a benchmark consisting of 1,393 tasks across 11 databases, designed to evaluate text-to-SQL systems'ability to ground underspecified natural language questions using historical SQL scripts, and a plug-in retriever that extracts five types of external knowledge from historical SQL scripts, then retrieves and reranks relevant fragments for query generation.

Yunfan Zhou, Qiming Shi, Yi-Zhou Yang et al. · 0 citations
Preprint Jul 2026

SQuaD-SQL: Efficient Text-to-SQL with Small Language Models via LLM-Guided Knowledge Distillation

SQuaD-SQL (Small-Qualified and Distilled for SQL), a novel approach that empowers small language models to approach the performance of LLMs on the Text-to-SQL task while significantly improving efficiency through knowledge distillation and synthetic data generation, is introduced.

Wangyu Wu, Xiaojian Lin, Rong Fu et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.