SQL Generation from Natural Language Using Supervised Learning and Recurrent Neural Networks

Discover our conference paper SQL Generation from Natural Language Using Supervised Learning and Recurrent Neural NetworksInternational Conference on Artificial Intelligence & Industrial Applications part of the Lecture Notes in Networks and Systems book series (LNNS, volume 144).


Thanks to the Novelis Reasearch Team for their knowledge and expertise.



The database stores today’s large amounts of data and information. To access these data, users need to master SQL or an equivalent interface language. Therefore, using a system that can convert natural language into equivalent SQL queries will make the data more accessible. In this sense, building a natural language interface to a relational database is an important and challenging problem in the field of natural language processing (NLP) and extensive research, and due to the introduction of large-scale data sets, it has recently been discovered again momentum. In this article, we propose a method based on word embedding and recurrent neural network (RNN), precisely based on long short-term memory (LSTM) and gated recurrent unit (GRU) units. We also showed the dataset used to train and test our model, based on WikiSQL, and finally we showed our progress in accuracy.


About the study

Vast amount of today’s information is stored in relational database and provide the foundation of applications such as medical records [1], financial markets [2], and cus- tomer relations management [3]. However, accessing relational databases requires an understanding of query languages such as SQL, which, while powerful, is difficult to master for non-technical users. Even for an expert, writing SQL queries can be chal- lenging, as it requires knowing the exact schema of the database and the roles of various entities in the query. Hence, researches has recently appeared to approach systems that map natural language to SQL query, and a long-standing goal has been to allow users to interact with the database through natural language [4,5]. We refer to this task as Text-to-SQL.

In this work, we present our approach based on Classifications [6] and Recurrent Neural Networks [7], precisely on LSTM [8] and GRU [9] cells. The idea is inspired from SQLNet approach [10]; in particular, we employ a sketch to generate a SQL query from naturel language. The sketch aligns naturally to the syntactical structure of a SQL query; Neural Networks are then used to predict the content for each slot in the sketch. Our approach can be viewed as a neural network alternative to the traditional sketch based program synthesis approaches [11,12].”


Part of the Lecture Notes in Networks and Systems book series (LNNS, volume 144)

SpringerLink provid researchers with access to millions of scientific documents from journals, books, series, protocols, reference works and proceedings.