Rule-Based SQL Grammar Validator

  • Syahrul Fajar Laqsono Universitas Bhinneka PGRI Tulungagung
  • Agung Prasetya Universitas Bhinneka PGRI Tulungagung
  • Mohamad Khoirul Ansor Universitas Bhinneka PGRI Tulungagung
Keywords: Texttosql, Grammarchecker, Sqlvalidation, Rulebased

Abstract

This study addresses the growing need for reliable data access systems by focusing on the validation of SQL queries generated from natural language using a Text-to-SQL approach. The primary objective of this research is to evaluate the effectiveness of a rule-based SQL grammar validator in detecting syntactic errors and improving the overall quality of queries generated by Large Language Models (LLMs), particularly in the context of Indonesian language input. The research methodology follows a structured process, including literature review, dataset construction, system design, implementation, and performance evaluation. Two datasets were developed: one for validating the grammar checker using both valid and invalid SQL queries, and another for evaluating the Text-to-SQL system. The validator was implemented using a rule-based system with grammar defined in EBNF and executed using forward chaining inference. The results indicate that the system achieves high performance, with an accuracy of 0.909, precision of 0.857, recall of 1.000, and F1-score of 0.923. The validator successfully identifies common structural errors such as missing table references and incomplete JOIN clauses. However, some limitations remain in detecting more complex syntax patterns. Overall, the integration of the grammar checker significantly enhances the reliability of SQL query generation. In conclusion, the proposed system demonstrates strong effectiveness in syntax validation and contributes to improving the robustness of Text-to-SQL systems.

Downloads

Download data is not yet available.

References

M. A. M. B. Baso Dzulkifli Muhajir, “SISTEM MANAJEMEN BASIS DATA TERHADAP PERUBAHAN KARAKTER PEMBELAJARAN DI SEKOLAH MTS AN-NUR RANTEBARU,” J. Ilm. Pendidik. Dasar, vol. 09, no. 03, 2024.

M. Aslyza, “MANAJEMEN DATA BERBASIS DATABASE : SOLUSI UNTUK PENYIMPANAN DAN AKSES DATA YANG LEBIH EFISIEN,” vol. 2, no. 3, pp. 909–917, 2025.

J. T. Santoso, SQL Structured Query Language. 2021.

Y. Salim and M. Hasnawi, “Konversi Bahasa Indonesia ke Perintah Data Manipulation Language pada Structured Query Language menggunakan Natural Language Processing,” vol. 3, no. 3, pp. 181–187, 2022.

R. S. U. Fitria Nur Hasanah, BASIS DATA. 2020.

M. Amien, “Sejarah dan Perkembangan Teknik Natural Language Processing ( NLP ) Bahasa Indonesia : Tinjauan tentang sejarah , perkembangan teknologi , dan aplikasi NLP dalam bahasa Indonesia,” pp. 99–105, 2023.

A. P. Oka Alvansyah, Nezza Anggraini Yolandari, M. Fikri Zulfi, Afifah Naila Nasution, “PEMBUATAN WEBSITE PEMINJAMAN BUKU PERPUSTAKAAN DIGITAL DENGAN INTEGRASI FITUR KECERDASAN BUATAN UNTUK MENINGKATKAN LITERASI,” vol. 3, no. 2, 2025.

D. Z. Oktavia, D. A. Hidayat, D. Natalia, and S. K. Prabantara, “Machine Learning Performance Comparison for Web Application Security Threat Detection : A Systematic Review,” vol. 5, no. 1, pp. 326–339, 2026.

M. I. P. N. Nayla Arnona Br Damanik, “IMPLEMENTASI MANAJEMEN BASIS DATA DALAM LINGKUP KECERDASAN BUATAN,” KAMPUS Akad. PUBLISING, vol. 2, no. 2, pp. 637–648, 2025.

I. Frincu, “In Search of the Perfect Prompt A User Evaluation of Soft and Hard Prompt Tech- niques for Conversational Abstract Generation,” 2023.

R. R. Golani, “LLM Fine-Tuning vs Prompt Engineering for Consumer Products,” vol. 16, no. 2, pp. 1–21.

X. Zhang et al., “Comparison of Prompt Engineering and Fine-Tuning Strategies in Large Language Models in the Classification of Clinical Notes 3 Department of Computer Science and Engineering , College of Engineering , Michigan State,” 2024.

I. W. Syahputri, E. K. Budiardjo, and P. O. H. Putra, “Unlocking the Potential of the Prompt Engineering Paradigm in Software Engineering : A Systematic Literature Review,” 2025.

C. D. Bui, H. H. Nguyen, and T. Q. Ngo, “A systematic survey of LLM-based text-to-SQL : methodologies , security vulnerabilities , and future challenges,” pp. 1–83, 2026, doi: 10.7717/peerj-cs.3773.

H. Bian et al., “DKASQL : Dynamic Knowledge Adaptation for Domain-Specific,” pp. 1–21, 2025.

Z. Shao, S. Cai, R. Lin, and Z. Ming, “Enhancing Text-to-SQL with Question Classification and Multi-Agent Collaboration,” pp. 4340–4349, 2025.

S. Patulus et al., “IMPLEMENTASI TEKNIK QUERY OPTIMIZATION UNTUK MENINGKATKAN,” vol. 9, no. 2, pp. 2437–2442, 2025.

Rachmawati, “ANALISIS KESALAHAN MENERAPKAN BAHASA SQL ( STRUCTURE QUERY LANGUAGE ) MATA KULIAH BASIS DATA Rachmawati IKIP Budi Utomo Malang Basis data diibaratkan sebagai arsip penyimpanan sebuah sistem Menurut Jogiyanto ( 2005 ) basis data adalah kumpulan dari data y,” J. Prism., vol. 1, no. 2, pp. 27–34, 2025.

G. Rafianto, A. Voutama, U. S. Karawang, T. Timur, and J. Barat, “IMPLEMENTASI BASIS DATA TERSTRUKTUR DENGAN PENCEGAHAN SQL INJECTION PADA SISTEM,” vol. 13, no. 2, 2025.

Z. Apriza, “Tantangan dan Solusi Pengelolaan Basis Data : Dari Keamanan Hingga Optimalisasi Query Keamanan menjadi salah satu prioritas utama dalam sistem basis data modern , terutama,” vol. 3, no. 2, pp. 448–454, 2025.

. Nugraha, R., Abdul Rezha Efrat Najaf, & Reisa Permatasari. (2025). BCA Stock Price Prediction Using Time Series Method With GRU (Gated Recurrent Unit). JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 432 - 440. https://doi.org/10.36378/jtos.v8i2.4500

. Mindara, G. P., Aisya Tyanafisya, Siti Farah Fakhirah, Azhar Nadhif Annaufal, Ibnu Aqil Mahendar, & Aditya Wicaksono. (2025). Design and Development of an E-Commerce Website Using the Waterfall Method with the Laravel Framework. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 441 - 452. https://doi.org/10.36378/jtos.v8i2.4570

. Siti Rodiyah, Sinulingga, S. M., Putra, F. R., Aryasatya, M. F., Kusdaryanto, A., Sulistiyono, R., & Irawan, B. (2025). Implementation of an Information System for Classroom Reservation at Esa Unggul University. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 453 - 466. https://doi.org/10.36378/jtos.v8i2.4633

. Joisce, Hanum Putri Kamelianti, & Rizal Aprianto. (2025). Concept And Potential For The Implementation Of Smart Parking System In Indonesia: A Literature Review . JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 467 - 481. https://doi.org/10.36378/jtos.v8i2.4647

. Fariz, Eka Dyar Wahyuni, & Tri Luhur Indayanti Sugata. (2025). Implementation of the FP-Growth Algorithm for Bundling Strategy and Store Layout Redesign at Toko Kasih Ibu. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 482 - 494. https://doi.org/10.36378/jtos.v8i2.4673

. Windy Fadhilah Susanti, Ana Wati, S. F., & Indayanti Sugata, T. L. (2025). UI/UX Design of the “PrintOn!” Printing Services Marketplace for UMKM Photocopying and Printing Businesses Using the User Centered Design Method. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 495 - 505. https://doi.org/10.36378/jtos.v8i2.4688

. Kartika, A. D. P., Anindo Saka Fitri, & Nambi Sembilu. (2025). Developing a Web-Based Printing Transaction System Using The Prototype Method: A Case Study at Amanah Advertising. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 514 - 528. https://doi.org/10.36378/jtos.v8i2.4692

. Irawan, Y., Refni Wahyuni, & Herianto. (2025). An Integrated Machine Learning and Deep Learning Approach for Multiclass Flood Risk Classification with Feature Selection and Imbalanced Data Handling. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 650 - 661. https://doi.org/10.36378/jtos.v8i2.4639

. Revina Pravita Sari, Karnadi, & Jimmie. (2025). Applying the Waterfall method to build applications E-Commerce at Palembang City Computer Embroidery Partners. JURNAL TEKNOLOGI DAN OPEN SOURCE, 8(2), 1243 - 1256. https://doi.org/10.36378/jtos.v8i2.5199

Published
2026-06-06
How to Cite
Fajar Laqsono, S., Agung Prasetya, & Mohamad Khoirul Ansor. (2026). Rule-Based SQL Grammar Validator. JURNAL TEKNOLOGI DAN OPEN SOURCE, 9(1), 79 - 87. https://doi.org/10.36378/jtos.v9i1.5474
Abstract viewed = 4 times
PDF downloaded = 6 times